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

Rotiraj

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

의견: 0

설명

\(5^{th}\) round, February \(16^{th}\), 2013

Mislav and Marko have devised a new game, creatively named Rotate. First, Mirko imagines a number
sequence of length N and divides it into sections, with each section containing K numbers (K evenly
divides N). The first section contains numbers in the first K positions in the sequence, the second
section the following K positions, and so on.
Then, Marko asks Mislav to apply a number of operations on the sequence, with each operation being
one of the following two types:
1. Rotate the numbers in each section to the le\(ft/ri\)ght by X positions
2. Rotate the whole sequence to the le\(ft/ri\)ght by X positions
Notice that an operation of type 2 can change the numbers belonging to each section. After applying all
the operations, Mislav reveals the final sequence to Marko. Marko's task is finding Mislav's starting
sequence. He has asked you for help.

제약

In test data worth at least 40% of total points, N will be at most 100.
In test data worth at least 70% of total points, K will be at most 100.
\(5^{th}\) round, February \(16^{th}\), 2013

입력 형식

The first line of input contains three positive integers: N (\(1 \le N \le 100\,000\)), the length of the
sequence, K (\(1 \le K \le 100\,000\)), the size of each section, and Q (\(1 \le Q \le 100\,000\)), the number of
operations.
Each of the following Q lines contains two integers: A (\(1 \le A \le 2\)), the operation type, and X (-100 000
\(X \le 100\,000\)), the number of positions to rotate by. A negative number represents rotation to the
left, while a positive one represents rotation to the right.
The last line of input contains N spa\(ce-se\)parated integers Z_{i} (\(0 \le Z_{i} \le 100\,000\)) representing the final
sequence (after applying all operations).

출력 형식

The first and only line of output must contain the required starting sequence.

예제 1
입력
4 2 2
2 2
1 1
3 2 1 0
출력
0 1 2 3
예제 2
입력
8 4 4
1 3
1 15
1 -5
2 -1
6 10 14 19 2 16 17 1
출력
6 10 14 1 2 16 17 19
예제 3
입력
9 3 5
1 1
2 -8
2 9
1 1
2 -4
3 1 8 7 4 5 2 6 9
출력
5 3 6 9 7 1 8 2 4
설명

Clarification of the first example: The starting sequence is 0 1 2 3. After the first operations, the
sequence is 2 3 0 1, and after the second operation, it becomes 3 2 1 0. Ths corresponds to the final
sequence.

문제 정보

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

출처 COCI 2012/2013 Contest 5

평가 및 의견

Rotiraj

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

Log in to rate problems.

개별 의견

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

풀이 제출

Rotiraj

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