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

Slika

Platinum II 플래티넘 II
난이도
2s
시간 제한
128MB
메모리 제한
0
맞았습니다!!
0
제출 수
0.0%
정답률
레이팅

의견: 0

설명

Mirko has just installed a brand new drawing program. The program supports \(K\) different colours, denoted by integers from \(1\) to \(K\). All drawing is performed on a canvas with dimensions \(N \times N\). In the beginning, all cells are white (denoted by \(1\)).

The upper-left cell of the canvas has coordinates \((0, 0)\). The first coordinate, \(x\), increases iterating over rows, and the second, \(y\), increases iterating over columns.

Mirko's favourite pastime is drawing rectangular checkerboard patterns using the command PAINT c x1 y1 x2 y2, where \(c\) denotes the chosen colour, and \((x_1, y_1)\) and \((x_2, y_2)\) are the coordinates of the upper-left and lower-right cells, respectively, of the rectangle being painted.

The upper-left cell of the rectangle will be painted in the chosen colour, while the rest are determined by the checkerboard pattern — a cell of the rectangle is painted with the chosen colour exactly when the sum of its row and column offsets from the upper-left corner is even. Cells that are not painted over by the chosen colour retain their previous colour.

Mirko has recently discovered two additional commands. He can save his painting at any time using the creatively named command SAVE, and load it again later using the command LOAD x, where \(x\) is a positive integer representing the ordinal number of the save.

제약
입력 형식

The first line of input contains three positive integers, \(N\) (\(1 \le N \le 1000\)), \(K\) (\(2 \le K \le 100\,000\)), and \(M\) (\(1 \le M \le 100\,000\), the number of commands).

Each of the following \(M\) lines contains one of the three described commands. Input will not contain any illegal commands.

출력 형식

Output must consist of \(N\) lines, each containing \(N\) integers representing the colours of cells in the corresponding row of the painting.

서브태스크
서브태스크점수설명

Test 1

10점

None

Test 2

10점

None

Test 3

10점

None

Test 4

10점

None

Test 5

10점

None

Test 6

10점

None

Test 7

10점

None

Test 8

10점

None

Test 9

10점

None

Test 10

10점

None

예제 1
입력
4 3 2
PAINT 2 0 0 3 3
PAINT 3 0 3 3 3
출력
2 1 2 3
1 2 1 2
2 1 2 3
1 2 1 2
예제 2
입력
3 3 4
PAINT 3 0 0 1 1
SAVE
PAINT 2 1 1 2 2
LOAD 1
출력
3 1 1
1 3 1
1 1 1
예제 3
입력
3 4 7
PAINT 2 0 0 1 1
SAVE
PAINT 3 1 1 2 2
SAVE
PAINT 4 0 2 0 2
LOAD 2
PAINT 4 2 0 2 0
출력
2 1 1
1 3 1
4 1 3
문제 정보

riseoj 작성

출처 COCI 2010/2011 Contest 5

평가 및 의견

Slika

개요
출제자 난이도 Platinum II 플래티넘 II 의견 0 / 50 공개 집계 (커뮤니티 난이도, 주요 주제, 품질)는 의견이 충분히 모이면 공개됩니다.

Log in to rate problems.

개별 의견

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

풀이 제출

Slika

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