1103A.md (1450B)
1 Source: https://codeforces.com/problemset/problem/1103/A 2 3 A. Grid game 4 5 time limit per test 6 7 1 second 8 9 memory limit per test 10 11 256 megabytes 12 13 input 14 15 standard input 16 17 output 18 19 standard output 20 21 You are given a 4x4 grid. You play a game — there is a sequence of tiles, each of them is either 2x1 or 1x2. Your task is to consequently place all tiles from the given sequence in the grid. When tile is placed, each cell which is located in fully occupied row or column is deleted (cells are deleted at the same time independently). You can place tile in the grid at any position, the only condition is that tiles (and tile parts) should not overlap. Your goal is to proceed all given figures and avoid crossing at any time. 22 23 Input 24 25 The only line contains a string $s$ consisting of zeroes and ones ($1 \le |s| \le 1000$). Zero describes vertical tile, one describes horizontal tile. 26 27 Output 28 29 Output $|s|$ lines — for each tile you should output two positive integers $r,c$, not exceeding $4$, representing numbers of smallest row and column intersecting with it. 30 31 If there exist multiple solutions, print any of them. 32 33 Example 34 35 Input 36 37 ``` 38 010 39 ``` 40 41 Output 42 43 ``` 44 1 1 45 1 2 46 1 4 47 ``` 48 49 Note 50 51 Following image illustrates the example after placing all three tiles: 52 53  Then the first row is deleted: 