RiseOJ는 solved.ac와 제휴 관계가 없습니다. 티어 아이콘 © solved.ac. solved.ac
포럼
COCI00248

Procesor

Unrated 레이팅 미적용
난이도
1s
시간 제한
32MB
메모리 제한
0
맞았습니다!!
0
제출 수
0.0%
정답률
레이팅

의견: 0

설명

\(3^{rd}\) round, December \(15^{th}\), 2012

Mirko has received an interesting homework assignment: to design his own little processor
(Mirkoprocessor). The processor has N registers with indices from 1 to N, and each register holds one
unsigned \(32-bi\)t integer in the usual binary format (the possible values range from 0 to \(2^{32} - 1\)).
The processor is capable of executing the following instruction types:

Instruction type
Description
Example
1 K M
Rotate the bits of
register K by M
positions to the right;
write the result back
to register K.
00000000000000000010001111111011
→ (\(M = 1010\)) →
11111110110000000000000000001000
(in base 10: 9211 → (\(M = 10\)) → 4 273 995 784)
2 K L
Compute the bitwise
XOR of registers K
and L; output the
result to the system
bus.
00000000000000000000001111000111
XOR 00000000000001111100000000000111
= 00000000000001111100001111000000
(in base 10: 967 XOR \(507\,911 = 508\,864\))

Mirko has already built a model of the processor, and only then realized that he'd forgotten to include
an operation to read the contents of a register. Now, his only option is to execute a large number of
type 1 and type 2 instructions and infer the register contents from the results. Having executed a
sequence of commands, he has asked you to help him derive the initial register contents consistent with
the obtained results.
If there are multiple possibilities for the initial register state combination, find the lexicographically
smallest one. (If two combinations have equal values in the first K – 1 registers and different values in
register K, the lexicographically smaller combination is the one with the smaller value in register K.)

제약

In test data worth a total of 64 points, the numbers N and E will be smaller than 1000.

입력 형식

The first line of input contains two positive integers: N (\(2 \le N \le 100\,000\)), the number of registers,
and E (\(1 \le E \le 100\,000\)), the number of executed instructions.
The remaining input lines describe the instructions in the order that they were executed by
Mirkoprocessor, formatted as described in the table above, one per line. All instructions are legal (the
following conditions hold: \(1 \le K\), \(L \le N\), \(0 \le M < 32\)). Each instruction of type 2 is followed by
another line containing a positive integer between 0 and \(2^{32}\) – 1, inclusive – the result of that operation
(the bitwise XOR value) in base 10.
\(3^{rd}\) round, December \(15^{th}\), 2012

출력 형식

The first and only line of output must contain the required N register values, separated by spaces.
If there is no possible combination of initial values consistent with input, output only the numb\(er -1\), to
notify Mirko that his processor has a bug.

예제 1
입력
3 3
2 1 2
1
2 1 3
2
2 2 3
3
출력
0 1 2
예제 2
입력
4 6
2 4 2
3
2 4 1
6
1 3 1
2 3 1
2
1 2 2
2 2 3
7
출력
5 0 14 3
예제 3
입력
5 6
2 4 2
10
2 5 3
2
2 2 3
1
2 1 4
3
1 3 1
2 3 4
2147483663
출력
15 6 7 12 5
문제 정보

생성자가 기록되지 않았습니다.

출처 COCI 2012/2013 Contest 3

평가 및 의견

Procesor

개요
출제자 난이도 Unrated 레이팅 미적용 의견 0 / 50 공개 집계 (커뮤니티 난이도, 주요 주제, 품질)는 의견이 충분히 모이면 공개됩니다.

Log in to rate problems.

개별 의견

아직 의견이 없습니다. 자격이 된다면 위 양식에서 가장 먼저 평가해 보세요.

풀이 제출

Procesor

게스트로 둘러보고 있습니다. 로그인하면 풀이를 제출하고 진행 상황을 확인할 수 있습니다. 로그인하고 제출하기
공개
C++20 Tab 들여쓰기 · Ctrl+/ 주석 토글 · Enter 자동 들여쓰기
1 1 1 0 공백: 4 · UTF-8