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

Slagalica

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

의견: 0

설명

1 \(s / 64\) \(MB / 110\) points

Since he learnt how to solve the Rubik's cube, Jurica has also been interested in other puzzles of this

kind and he recently created an enigmatic toy himself. We can imagine Jurica’s puzzle as a triangular

net in the form of a parallelogram whose nodes are arranged in \(N\) rows and \(M\) columns. The rows are

labeled from 1 to \(N\) from the bottom up , and the columns are labeled 1 to \(M\) from left to right .

Each node is denoted by coordinates ( \(x\) , \(y\) ), where \(x\) is the row and \(y\) is the column. Each node has a

unique integer value between 1 and \(N \cdot M\) written in it, and the puzzle is considered solved when the

first row contains numbers from 1 to \(M\) ordered from left to right, the second row contains numbers

from \(M\) +1 to 2 \(M\) in the same order, etc. The picture below shows a solved puzzle of 3 rows and 4

columns.

The layout of the puzzle can be changed in two ways:
1.
By selecting the unit sized rhombus whose nodes are determined by the coordinates ( \(x\) , \(y\) ),
( \(x\) +1, \(y\) ), ( \(x\) +1, \(y\) +1) and ( \(x\) , \(y\) +1), and rotating the node values in the clockwise direction.
2.
By selecting a unit sized equilateral triangle whose nodes are determined by the coordinates
(x, y), (\(x+1\), y) and (x, \(y+1\)) and rotating of the node values in the clockwise direction.

On one boring day, Jurica scrambled the puzzle, writing down the moves he had made on a piece of

paper. This sequence of moves he called a me\(ga-mo\)ve, and explained the application of me\(ga-mo\)ve

as the sequential application of the moves written on the paper. After that, he has repeatedly made

the same me\(ga-mo\)ve several times. He noticed an unusual regularity soon. Starting from a solved

puzzle, after exactly K me\(ga-mo\)ves, the puzzle will again be solved (the first time since applying the

me\(ga-mo\)ves).

For given integers \(N\) , \(M\) and \(K\) , determine if there is a me\(ga-mo\)ve that will allow Jurica to solve the

puzzle after exactly \(K\) repetition of that me\(ga-mo\)ve, and if so, print that sequence of moves. Note :

The solution is not necessarily unique and does not have to be optimal in the number of the moves,

but the number of moves is limited (see section Input ).

1 \(s / 64\) \(MB / 110\) points

제약

In the test samples worth 40% of the points it will hold that \(N\) , \(M\) ≤ 3 and \(K\) ≤ 20.

입력 형식

The first line contains three integers \(N\) , \(M\) (2 ≤ \(N\) , \(M \le 100\)) and \(K\) (2 ≤ \(K \le 10\) {12}{ }), the numbers from the

task description.

출력 형식

If there is not such a me\(ga-mo\)ve that meet the conditions from the task, pri\(nt -1\) in the only line.
Otherwise, print the number of moves B (\(1 \le B \le 500\,000\)) in the first line and in the following \(B\) lines

one move in the following form:

"R x y" (without the quotation marks) if it is a rotation of a rhombus (operation 1), or

"T x y" (without the quotation marks) if it is a rotation of an equilateral triangle (operation 2),
whereas the coordinate ( \(x\) , \(y\) ) represents the bottom left node of the rhombus or the triangle and it

holds that 1 ≤ \(x\) < \(N\) and 1 ≤ \(y\) < \(M\) .

예제 1
입력
2 3 2
출력
5
R 1 1
R 1 1
T 1 1
T 1 1
T 1 1
예제 2
입력
3 3 12
출력
3
R 1 1
T 2 2
T 2 1
예제 3
입력
5 4 116
출력
-1
문제 정보

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

출처 COCI 2018/2019 Contest 4

평가 및 의견

Slagalica

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

Log in to rate problems.

개별 의견

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

풀이 제출

Slagalica

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