QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#785552#3887. Logic Puzzleucup-team4645AC ✓1ms4184kbC++231.7kb2024-11-26 18:14:232024-11-26 18:14:23

详细

Test #1:

score: 100
Accepted
time: 0ms
memory: 3576kb

input:

2 3
1 1 2 1 1
1 2 3 2 1
1 2 3 2 1
0 1 1 1 0

output:

X.X
.X.

result:

ok correct solution

Test #2:

score: 0
Accepted
time: 0ms
memory: 3640kb

input:

1 2
0 0 1 1
0 1 1 1
0 1 1 1

output:

impossible

result:

ok impossible

Test #3:

score: 0
Accepted
time: 0ms
memory: 3596kb

input:

1 1
1 1 1
1 1 1
1 1 1

output:

X

result:

ok correct solution

Test #4:

score: 0
Accepted
time: 0ms
memory: 3636kb

input:

2 1
1 1 1
2 2 2
2 2 2
1 1 1

output:

X
X

result:

ok correct solution

Test #5:

score: 0
Accepted
time: 1ms
memory: 4184kb

input:

97 93
1 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 2 1
2 4 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 ...

output:

XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXX...

result:

ok correct solution

Test #6:

score: 0
Accepted
time: 0ms
memory: 4016kb

input:

94 99
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

output:

...................................................................................................
...................................................................................................
...................................................................................................
...

result:

ok correct solution

Test #7:

score: 0
Accepted
time: 0ms
memory: 3672kb

input:

10 8
1 2 3 3 3 3 3 3 2 1
2 3 5 5 6 6 6 6 4 2
3 5 8 8 9 9 9 9 6 3
3 5 8 8 9 9 9 9 6 3
3 6 9 9 9 9 9 9 6 3
3 6 9 9 9 9 9 9 6 3
3 6 9 9 9 9 9 9 6 3
3 6 9 9 9 8 8 8 6 3
3 6 9 9 9 8 8 8 6 3
3 6 9 9 9 8 8 8 6 3
2 4 6 6 6 6 6 6 4 2
1 2 3 3 3 3 3 3 2 1

output:

XXXXXXXX
X.XXXXXX
XXXXXXXX
XXXXXXXX
XXXXXXXX
XXXXXXXX
XXXXXXXX
XXXXX.XX
XXXXXXXX
XXXXXXXX

result:

ok correct solution

Test #8:

score: 0
Accepted
time: 0ms
memory: 3592kb

input:

7 11
0 0 0 0 0 0 0 0 0 0 1 1 1
0 0 0 0 0 0 0 0 0 0 1 1 1
0 1 1 1 0 0 0 0 0 0 1 1 1
0 1 1 1 0 0 0 0 0 0 0 0 0
0 1 1 1 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 1 1 1 0 0 0 0 0 0 0
0 0 0 1 1 1 0 0 0 0 0 0 0
0 0 0 1 1 1 0 0 0 0 0 0 0

output:

..........X
...........
.X.........
...........
...........
...........
...X.......

result:

ok correct solution

Test #9:

score: 0
Accepted
time: 0ms
memory: 3588kb

input:

3 77
0 1 1 2 1 1 0 1 1 2 2 2 2 2 2 2 1 2 1 1 1 1 2 1 1 1 1 2 2 3 2 1 1 1 2 2 3 2 2 2 2 2 1 1 0 1 1 2 2 3 3 3 2 2 1 1 1 1 1 1 1 2 2 3 2 2 2 3 2 2 2 3 2 1 0 1 2 2 1
1 3 4 4 3 2 2 2 3 3 3 2 3 4 4 3 2 3 3 3 3 3 3 2 2 2 3 4 5 6 5 4 3 3 3 3 3 3 4 5 4 4 2 3 2 4 3 4 3 4 4 5 5 4 3 3 4 4 4 4 3 4 4 6 4 4 3 5 4...

output:

.X.X...X.XX.XX.X.X..X.X..X.XXX..X.XXX.XX.X...X.XXXXX.X..X..X.XXX.XXX.XXX...XX
XXX.X.X.X...XX..X.XX.X..X.XXXXXX.X...XXX.X.XXX.X..XXX.XXXXXX.XXX.X.XXXX.XX.XX
XXXXXXX.XX....X..XX.........X.X..X..X.X...XXXXXXXX......XXXXXX..XX....X..X..X

result:

ok correct solution

Test #10:

score: 0
Accepted
time: 1ms
memory: 3892kb

input:

54 64
0 0 1 2 3 2 2 2 3 3 2 2 1 2 1 2 2 2 2 2 3 3 3 2 1 0 1 1 2 2 2 2 1 1 1 1 2 1 1 0 0 1 1 2 1 2 1 1 1 1 2 2 2 2 2 3 2 2 2 3 3 2 2 1 1 0
1 2 4 5 5 3 2 2 4 4 3 2 1 3 3 4 4 4 5 4 4 4 5 5 4 3 4 3 3 3 4 4 2 1 1 2 4 3 2 1 2 3 2 2 1 3 2 2 2 2 3 2 2 2 3 4 3 3 4 6 5 3 2 2 2 1
2 4 7 8 7 5 3 3 4 5 4 4 3 6 6 ...

output:

..XXX.XXXX.X.X.XX.XXXXX...X.XX.X..X.X....X.X.X..X.XX.XXX.XXXX.X.
XXXX....X....XX.XXX..XXXXXX..XX....XX..XX....X..X.....X..XXX...X
XXXX.X...X.XXXX...XXXX...X.X.XX.XX.XXX...XX.XXX.......XX..XX.X..
.X.....X...X.X.X...XX...X...XXX.XXX....XX.X..X.X.XX...X...X...X.
.X.XXXXX..XX..XXX...X...X.X.XXX.....XX.....

result:

ok correct solution

Test #11:

score: 0
Accepted
time: 1ms
memory: 3944kb

input:

54 3
1 1 2 1 1
1 2 4 3 2
1 2 4 3 2
1 2 4 3 2
1 2 3 2 1
1 3 4 3 1
0 2 3 3 1
0 1 2 2 1
0 1 3 3 2
1 2 3 2 1
2 3 5 3 2
3 4 6 3 2
3 4 6 3 2
3 4 5 2 1
3 3 3 0 0
2 3 4 2 1
2 3 4 2 1
2 3 5 3 2
3 4 6 3 2
3 5 7 4 2
2 5 6 4 1
2 4 4 2 0
2 3 3 1 0
3 3 4 1 1
2 3 4 2 1
2 3 5 3 2
2 4 5 3 1
3 5 7 4 2
3 6 8 5 2
2 5 8...

output:

X.X
.XX
...
X.X
.X.
.X.
..X
...
.XX
X..
X.X
XXX
X..
X..
X..
.XX
X..
X.X
XXX
XX.
.X.
X..
X..
X.X
.X.
X.X
XX.
XXX
XXX
.XX
XX.
.XX
.X.
XX.
X..
XXX
XXX
.X.
X..
XXX
.XX
XXX
X.X
...
X.X
..X
X..
X..
..X
..X
.X.
.X.
.XX
.X.

result:

ok correct solution

Test #12:

score: 0
Accepted
time: 1ms
memory: 4096kb

input:

79 27
0 1 2 2 1 0 0 1 2 3 2 2 2 3 2 2 1 1 1 2 3 3 2 1 0 1 2 2 1
1 3 5 4 2 1 2 4 4 4 3 4 4 5 3 3 2 3 4 4 4 3 2 1 0 2 4 4 2
1 3 6 5 4 3 4 5 4 4 3 5 5 7 5 5 4 5 7 6 5 4 4 4 2 3 4 4 2
1 2 4 3 4 4 6 5 3 2 2 5 5 7 6 6 5 6 8 7 5 4 4 5 3 3 3 3 2
0 0 1 1 4 5 7 4 3 2 2 4 5 8 7 6 5 5 6 6 5 5 5 6 5 4 4 3 2
1 2 ...

output:

.XX....XXX.XXX.X..XXXX...XX
XXX..XXX..XX.X..XXX......XX
..X.XX.....X.XX.XXX..XXX...
....X.X..X.XXXXX.XXXXX.X..X
....XXX.X..XXX..X..X..X.XXX
XXXX...X.X.XXXXX.X.XX..XXXX
.XXXXXXXX.XXXX.XXXX..XX.X.X
X.XX.......X.XXXXX.XX...X.X
.X..X.X.X.X.X.XX.XX.XXXX.X.
XX.XX.X....X.XXX.XX..XXXXXX
X.XXX..X.XXX..XXXXXX...

result:

ok correct solution

Test #13:

score: 0
Accepted
time: 0ms
memory: 3644kb

input:

16 24
0 0 1 1 2 1 1 0 1 2 2 2 1 2 2 3 2 1 0 1 1 2 2 3 2 1
1 2 4 4 4 3 2 2 3 4 3 3 2 4 3 4 3 3 2 3 2 4 4 6 4 2
1 2 5 6 6 4 3 3 4 5 4 5 3 6 5 6 5 5 4 4 3 5 6 7 5 2
1 3 5 7 6 5 3 3 4 4 3 3 3 5 4 4 4 6 6 6 4 4 4 4 3 1
0 1 3 5 6 5 5 3 4 3 4 4 5 5 4 4 5 7 7 6 4 2 2 1 1 0
0 1 2 4 6 6 5 2 4 3 4 3 6 5 3 3 4 ...

output:

..X.X...XX.X.XXX...X.XXX
XXXX.X.XX..X.X..XX.X.XXX
..XX..X..X.X.XX.XX..X.X.
.X.XX...X...X..X.XXX....
..X.XXX.X.XXX..XXXX.....
...XX...X..XX..X....XXX.
.XXX...XX...XXXXX.XX..XX
....X.X..X.X...XXX.XX.XX
.XXX..XXX.XX.X.X...XXXXX
X.XX.X.XX.X.XXX..X.XX...
XXXXXXXXXXX.X..X......XX
.X.X.X..X..XX.XX.X..XX..
...

result:

ok correct solution

Test #14:

score: 0
Accepted
time: 0ms
memory: 3968kb

input:

83 84
1 2 3 2 2 1 1 1 1 2 2 3 2 1 1 2 2 1 1 1 1 0 0 0 0 0 1 2 3 3 2 2 1 1 0 0 0 0 0 1 1 1 1 2 3 2 2 1 2 1 1 0 1 2 3 2 1 1 1 1 1 2 2 1 1 1 1 0 1 2 2 1 1 2 3 3 2 2 2 2 1 0 1 1 1 0
1 3 4 4 4 4 3 3 2 4 4 5 3 1 2 3 3 1 1 1 1 0 1 2 2 2 2 3 3 3 3 4 3 2 1 1 2 1 2 2 2 2 3 4 4 3 4 4 4 2 2 1 3 4 5 4 3 3 2 1 2 ...

output:

XXX.X..X.XXX..XX..X.......XXXX.X.......X..XXX.X.X...XXX..X..XX..X...XX..XXXX.XX...X.
.X.XXX.X.XX...X.......XX.X....XX..X.X.X..XX..XXX..X.XX.XX...X..X....X.X..XXXX...X.X.
.X...XX....XX..XX..X.XX.....X.X...XX.XX.....X...X..X...X.X..XX....X.XXX....XXX...X.X
.XXX.XX.X.X.XXXXXXXXX.XX.....X.X.X.XX..XX..XX...

result:

ok correct solution

Test #15:

score: 0
Accepted
time: 0ms
memory: 3660kb

input:

21 25
1 1 1 0 0 1 1 1 0 1 1 1 0 1 2 2 2 2 3 3 2 2 1 1 1 1 1
1 2 3 2 2 3 4 3 1 1 2 3 3 3 3 2 3 4 6 5 4 3 2 2 2 2 1
2 3 4 2 3 5 7 6 4 4 5 6 6 5 5 3 4 5 8 8 6 4 2 2 2 2 1
2 3 5 3 4 4 6 5 5 5 6 7 7 6 5 3 4 4 6 6 5 4 2 2 2 2 1
3 4 5 2 2 3 4 5 6 8 7 6 5 6 7 6 6 5 5 6 4 5 3 4 3 2 1
3 4 6 4 4 4 4 5 6 7 5 4 ...

output:

X....X...X...XX.XXXX.X..X
.XX.XXX...XXX...XXX.X..X.
X...XXXXXXXXX.X..XXX.....
X.X.....XX.X.XX.X..X.X..X
XX...X.XXX..XXXXXX.X.XXX.
X.XXXXXXX..XX..XXXX.X...X
.X..XXX.XX..X...X...X...X
X...X.XXXXX.X..XXXX.....X
X..XX.XXXXXXX.XX..X..X..X
...XX.....XX.X..X.X..X...
XX...XXX..X.XXX.XXXX.XXXX
XXX......XX......

result:

ok correct solution

Test #16:

score: 0
Accepted
time: 1ms
memory: 4000kb

input:

60 34
0 1 1 1 0 1 2 2 1 1 2 2 1 1 1 1 0 1 2 3 3 3 3 3 3 2 2 1 1 0 1 2 3 2 1 0
1 2 3 3 3 3 3 3 3 4 5 4 2 1 2 3 2 3 4 6 6 6 5 5 4 3 3 2 2 1 2 3 3 2 1 0
2 3 5 4 5 5 5 5 5 7 8 7 5 3 4 5 4 5 6 8 7 7 7 7 5 3 3 3 3 3 3 4 3 2 1 0
3 3 6 4 7 6 5 5 6 9 8 7 6 4 5 5 6 5 5 6 6 7 6 5 2 2 2 4 3 4 3 3 2 2 2 1
3 4 7 ...

output:

.X...XX..XX..X...XXXXXXXX.X...XXX.
X.XXX..XXXX...XX.XXXXX.X..X..X....
X.X.XX.XXXXXX.XX.XX..XX....X.X....
X.X.XX.XXX.XX.X.X..XXX...X.X..X.XX
XXXXXXXXXX.X..XX.X.XXX..XXXXX.XX.X
XXXXXX...XX....X..XX.X....X..XXXXX
XX...XX...XX..X.X...XXX.X..X..XX..
.X...XX...X.XXXX.XX..X.XXX..XXXXXX
..XXX...XX.XX..XXX.....

result:

ok correct solution

Test #17:

score: 0
Accepted
time: 0ms
memory: 3788kb

input:

44 95
0 1 1 2 1 2 2 3 3 3 3 2 1 0 1 2 3 2 1 1 2 2 1 1 1 2 2 2 1 0 0 1 1 2 2 2 1 1 1 1 0 0 0 1 1 1 1 1 2 1 1 1 2 3 2 1 0 0 0 1 1 2 2 3 3 3 2 1 1 1 1 0 1 2 3 2 1 1 1 1 1 2 2 2 1 2 2 3 3 2 2 1 1 1 1 1 0
0 2 2 3 2 4 5 6 6 6 6 5 3 2 2 4 5 4 2 1 3 4 3 3 3 5 5 4 2 1 2 4 4 4 3 2 1 1 1 2 1 1 1 3 3 2 2 3 5 4 ...

output:

.X.X.XXXXXX...XXX..XX..X.XX....X.XX..X.....X..X.X..XXX.....X.XXXXX..X...XXX..X..XX.X.XXXX.X..X.
.X..XXXXXXXX.X.XX...XX.XXXX..XXXX......X..XX..XXXX..XX.XXX..X.....XXX.XXXXX....X.X..XX.XXX....X
XXX.X..X.X.X.XX..XXX.......XXXX.XXXX...X.X..X.X....XXXX...X..XX..X.XXX..XXXX...XXX.XX...X...X.X
.X..XXX.XXX....

result:

ok correct solution

Test #18:

score: 0
Accepted
time: 0ms
memory: 3640kb

input:

10 87
1 2 2 2 2 3 3 2 2 2 2 2 1 1 1 1 2 2 3 2 1 0 1 2 2 2 2 2 1 0 0 0 1 2 3 3 3 3 2 2 2 2 2 1 2 1 2 2 2 1 1 1 2 2 2 2 2 2 1 1 2 3 2 2 2 2 2 1 1 1 1 2 1 2 1 1 0 1 2 3 2 2 1 1 1 2 2 1 0
1 2 3 3 4 5 6 5 4 4 3 4 2 2 1 1 3 3 4 2 2 1 2 2 3 3 4 3 3 1 1 0 2 3 5 5 6 6 4 3 3 4 4 3 3 3 3 3 3 3 4 4 4 4 3 3 2 3 ...

output:

XX.XXXX.XX.X..X.XXX...XX.XX.....XXXXXX.XX.X.X.XX..X.XX.XX..XXX.XX.X..X.X.X...XXX.X..XX.
..X.XXXX.X.X....X...X...X.X.X...X.XXXX..XX.X.X..XXXX.X...X...XX..XX...X....XX..X..X..XX
.X.X...X..XXX..XXX.XXX.XX...X.....XXX.X.X.X.X....X.X..X.X.XXX.X.XX...XX..XX...X.XX....X
..X.....X.X.XX.X.XX..X.XX...X...X......

result:

ok correct solution

Test #19:

score: 0
Accepted
time: 1ms
memory: 3800kb

input:

71 43
1 1 1 0 0 1 2 2 2 2 2 1 0 1 1 1 0 1 2 2 1 1 1 2 2 3 3 3 3 2 2 1 1 0 1 2 3 3 2 2 1 2 1 1 0
2 3 4 2 1 2 4 5 4 4 4 4 3 4 4 3 2 2 3 2 2 2 2 3 3 5 4 4 3 3 4 3 3 1 3 4 5 5 4 4 3 4 3 2 0
2 4 5 4 2 4 5 7 5 6 6 6 4 5 5 5 3 3 3 3 3 4 4 5 4 5 5 6 5 5 5 5 4 3 5 7 7 7 6 7 6 7 5 3 0
2 5 7 7 4 4 3 5 3 4 5 7 ...

output:

impossible

result:

ok impossible

Test #20:

score: 0
Accepted
time: 1ms
memory: 3904kb

input:

69 2
0 1 1 1
1 2 2 1
2 3 3 1
2 2 2 0
2 3 3 1
2 3 3 1
3 5 5 2
3 5 5 2
2 5 5 3
1 4 4 3
0 3 3 3
0 2 2 2
1 2 2 1
1 2 2 1
2 3 3 1
2 3 3 1
2 3 3 1
2 3 3 1
1 2 2 1
2 3 3 1
2 3 3 1
2 4 4 2
1 2 2 1
1 3 3 2
2 4 4 2
3 5 5 2
3 5 5 2
3 4 4 1
2 3 3 1
1 1 1 0
1 1 1 0
1 2 2 1
1 2 2 1
0 1 1 1
0 1 1 1
0 1 1 1
0 2 2 2...

output:

impossible

result:

ok impossible

Test #21:

score: 0
Accepted
time: 0ms
memory: 3680kb

input:

6 27
1 2 3 3 3 3 2 2 1 2 2 2 1 0 0 0 0 1 2 3 2 2 1 1 0 1 1 1 0
2 4 5 4 3 3 3 3 2 3 3 3 1 0 1 2 3 3 3 4 3 3 2 2 2 3 3 2 0
2 4 5 5 5 5 4 3 3 5 5 5 3 2 2 2 4 5 5 6 4 4 2 2 3 5 5 3 0
1 3 3 4 3 3 2 2 3 4 3 4 3 4 4 4 6 5 5 4 4 3 2 2 5 7 7 4 1
0 2 3 6 5 4 1 2 4 6 4 5 4 6 5 5 6 5 7 5 5 3 3 2 4 5 6 4 2
1 3 5...

output:

impossible

result:

ok impossible

Test #22:

score: 0
Accepted
time: 0ms
memory: 3728kb

input:

16 50
0 1 2 2 1 0 1 2 2 2 1 2 1 2 2 3 2 2 2 2 1 0 0 0 1 2 2 2 2 3 3 2 2 1 1 0 1 1 1 0 1 2 2 1 0 1 1 2 2 3 2 1
0 1 2 3 3 2 2 2 2 2 1 3 3 4 3 3 3 3 3 2 2 1 2 2 4 4 4 4 4 5 5 5 4 2 2 1 3 2 3 1 3 4 4 2 0 2 3 5 4 4 2 1
0 2 4 5 5 3 4 4 4 3 2 4 4 4 4 5 6 6 5 4 3 3 4 4 5 5 5 5 5 6 6 5 4 2 2 1 4 3 4 1 3 4 5 ...

output:

impossible

result:

ok impossible

Test #23:

score: 0
Accepted
time: 0ms
memory: 3668kb

input:

17 45
1 2 2 1 1 1 1 0 0 0 0 0 1 1 2 1 1 1 2 2 1 0 0 0 1 2 2 2 1 2 1 2 2 3 2 1 0 1 2 3 3 2 1 1 1 1 0
1 2 3 2 2 1 1 0 1 2 2 2 2 3 3 2 1 1 2 2 2 2 2 1 2 3 3 3 2 3 1 3 3 4 3 3 3 3 3 4 4 3 2 3 3 2 0
1 2 4 3 4 2 2 0 2 4 4 4 3 4 3 2 2 2 4 3 3 3 3 3 4 5 4 3 2 3 2 4 5 6 6 5 4 3 4 6 7 5 4 4 4 2 0
0 1 3 4 5 3 ...

output:

impossible

result:

ok impossible

Test #24:

score: 0
Accepted
time: 0ms
memory: 3684kb

input:

38 4
0 1 2 3 2 1
1 3 5 6 4 2
1 3 6 7 5 2
1 2 5 5 4 1
0 0 2 2 2 0
0 0 1 2 2 1
1 1 2 3 3 2
1 2 4 6 5 3
1 3 6 7 5 2
1 4 6 7 4 2
2 5 6 5 2 1
2 4 4 4 2 2
1 3 3 4 2 2
0 1 2 4 3 2
1 2 3 3 2 1
1 2 3 3 2 1
2 3 4 3 2 1
1 2 3 3 2 1
1 1 3 3 2 1
0 2 3 5 3 2
1 4 6 7 4 2
1 3 6 6 4 1
2 3 6 4 3 0
1 1 4 4 4 1
2 3 5 4...

output:

impossible

result:

ok impossible

Test #25:

score: 0
Accepted
time: 0ms
memory: 3736kb

input:

3 67
0 1 2 3 2 2 2 3 3 3 2 2 1 2 1 2 1 1 0 1 1 1 1 1 1 0 1 1 1 0 0 1 1 1 0 0 0 0 0 0 1 2 3 2 2 1 1 0 1 2 3 3 2 2 1 2 1 1 0 1 1 2 1 2 1 2 1 1 0
1 2 4 5 4 4 4 6 6 5 3 3 3 4 3 4 4 4 2 2 1 1 2 3 4 2 2 2 3 2 2 2 3 3 2 2 1 1 1 1 3 4 5 4 3 2 2 2 3 4 4 4 2 2 1 2 2 3 2 2 1 2 2 3 3 3 2 1 0
1 3 6 8 7 7 7 8 7 5...

output:

impossible

result:

ok impossible

Test #26:

score: 0
Accepted
time: 1ms
memory: 3752kb

input:

57 28
1 2 2 2 2 3 3 2 1 1 2 2 2 1 1 0 0 1 2 2 1 1 1 1 1 2 2 1 0 0
1 2 3 3 3 3 4 4 3 3 3 4 3 2 1 0 1 2 4 3 2 1 2 3 3 4 3 2 0 0
2 3 4 3 4 4 6 6 6 6 6 7 5 3 2 2 4 5 6 5 3 3 3 5 4 6 5 5 2 1
2 2 4 3 5 3 4 4 6 6 5 6 5 4 3 3 6 5 5 4 3 4 4 7 6 6 5 5 3 1
2 3 5 4 5 4 4 4 5 6 5 5 5 5 5 5 6 6 4 4 2 5 4 7 6 6 6 ...

output:

impossible

result:

ok impossible

Test #27:

score: 0
Accepted
time: 1ms
memory: 4024kb

input:

94 70
0 1 1 2 1 2 1 2 1 1 1 1 2 2 2 1 1 1 2 1 1 1 1 2 1 2 1 2 2 2 2 1 1 1 1 1 1 2 2 2 2 3 2 2 2 2 2 2 3 3 2 1 1 1 1 1 1 2 2 2 1 1 2 2 2 1 2 1 2 1 1 0
0 2 2 4 3 4 2 3 3 3 3 2 3 2 3 3 3 3 3 2 1 2 2 4 2 4 2 3 2 2 2 2 2 3 3 4 4 5 5 5 4 4 2 3 4 5 4 3 4 5 5 3 3 2 2 2 2 3 2 3 3 4 5 5 4 2 3 2 3 2 2 1
0 3 3 ...

output:

impossible

result:

ok impossible

Test #28:

score: 0
Accepted
time: 0ms
memory: 3628kb

input:

23 85
0 0 0 0 1 1 1 1 2 3 2 1 0 1 1 1 1 2 2 1 0 0 1 2 3 3 3 3 2 2 2 3 2 1 0 0 0 0 1 1 1 0 1 1 1 1 2 2 2 2 3 3 2 1 1 1 1 1 1 2 2 2 2 2 2 2 1 2 1 1 0 1 2 2 1 0 0 1 2 3 3 2 2 1 2 1 1
1 2 2 2 2 3 2 3 4 5 3 2 2 3 2 2 3 5 5 4 2 2 2 3 4 4 4 3 2 3 3 4 3 2 2 1 1 0 2 2 3 1 3 3 3 2 3 3 3 2 3 3 2 1 2 2 3 3 3 4 ...

output:

impossible

result:

ok impossible

Test #29:

score: 0
Accepted
time: 0ms
memory: 3716kb

input:

59 12
8 0 1 1 6 6 3 5 2 4 5 4 0 2
4 1 1 8 6 1 7 3 4 4 0 1 5 2
2 1 2 3 5 0 6 4 4 7 8 7 7 4
0 2 4 4 1 9 4 2 8 3 2 3 5 2
3 3 7 8 2 2 5 7 3 9 5 6 5 2
0 1 5 1 5 3 1 4 0 4 3 1 5 4
6 0 3 0 7 8 3 3 3 5 6 4 6 1
3 8 5 3 0 4 5 0 3 4 8 3 4 8
2 4 7 8 7 3 0 2 7 5 0 6 4 1
8 3 1 6 4 3 2 1 4 7 1 7 1 6
7 0 5 5 1 3 2 ...

output:

impossible

result:

ok impossible

Test #30:

score: 0
Accepted
time: 0ms
memory: 3652kb

input:

9 17
4 5 8 8 8 8 6 1 8 1 1 1 8 2 6 7 7 4 2
1 2 2 7 3 6 9 5 1 7 6 9 7 7 3 6 2 1 3
8 6 1 6 2 5 6 1 8 7 2 3 0 1 2 0 3 0 3
9 2 5 6 7 5 8 8 4 2 8 5 5 6 7 1 7 5 1
5 2 3 6 4 5 1 3 4 1 0 3 5 6 2 4 3 4 7
0 2 4 7 4 2 4 1 4 3 7 8 7 5 7 8 5 8 3
2 5 6 7 7 0 5 5 5 4 6 6 3 7 0 1 4 4 5
2 5 5 9 5 3 3 3 7 5 7 1 5 6 1...

output:

impossible

result:

ok impossible

Test #31:

score: 0
Accepted
time: 1ms
memory: 3684kb

input:

71 78
2 1 2 1 0 2 1 2 2 4 0 2 2 2 1 1 1 2 4 4 2 2 3 1 0 2 1 2 0 1 2 2 1 1 0 0 0 1 0 2 2 1 1 0 2 3 3 3 3 3 1 2 2 3 3 2 1 2 3 3 3 3 2 1 1 2 4 1 0 1 1 1 2 1 2 3 2 2 1 1
1 1 1 0 3 3 3 2 3 4 3 3 3 3 2 3 3 4 4 4 5 3 2 3 2 4 2 1 1 4 4 2 2 0 1 1 2 4 3 2 3 3 4 1 4 4 4 4 5 3 2 2 4 7 5 3 2 3 3 3 4 4 6 4 4 4 4 ...

output:

impossible

result:

ok impossible

Test #32:

score: 0
Accepted
time: 0ms
memory: 3616kb

input:

17 47
8 9 1 2 9 0 7 9 5 1 6 2 3 3 2 2 8 4 6 1 9 8 7 3 7 8 8 3 2 5 2 8 1 1 5 1 4 7 4 5 5 4 2 9 2 5 4 2 7
6 1 1 4 1 3 2 9 0 6 6 5 7 1 5 6 5 5 1 4 8 3 0 4 3 6 6 4 7 6 7 6 2 6 0 9 5 6 6 2 0 4 6 5 7 6 9 3 6
3 5 2 1 4 5 1 3 3 5 0 3 6 6 5 9 8 9 0 1 7 5 5 6 7 5 7 4 6 2 8 1 9 1 9 5 5 5 8 8 2 1 8 0 2 9 8 4 3
...

output:

impossible

result:

ok impossible

Test #33:

score: 0
Accepted
time: 1ms
memory: 3784kb

input:

99 17
4 0 1 5 2 3 5 1 0 2 9 2 1 3 0 2 3 4 1
6 7 5 6 5 7 3 2 4 3 3 0 2 6 4 1 7 2 3
2 4 3 6 4 7 3 6 6 6 3 7 2 6 5 2 6 3 6
3 3 5 7 6 1 4 3 1 5 8 7 9 4 7 8 1 6 6
3 1 7 2 5 1 4 7 0 9 3 7 2 7 0 4 7 7 1
2 2 5 7 9 3 4 3 8 2 8 3 8 3 2 6 6 8 3
4 1 3 4 4 3 3 0 5 6 8 3 5 7 8 2 4 4 3
2 1 2 6 4 7 2 4 6 2 6 4 5 3 ...

output:

impossible

result:

ok impossible

Test #34:

score: 0
Accepted
time: 0ms
memory: 3692kb

input:

22 5
3 6 1 1 3 2 7
2 2 9 9 4 3 1
2 6 2 5 8 6 5
2 0 1 9 8 1 7
3 4 1 8 6 3 6
7 4 1 8 0 8 8
4 1 5 2 1 7 5
1 5 2 9 9 0 4
3 3 3 4 6 8 6
2 3 1 9 4 2 1
9 9 2 1 3 3 3
6 2 7 6 5 1 2
4 8 8 5 7 3 6
0 6 7 3 6 4 6
5 6 2 1 4 6 3
9 3 5 9 4 7 7
3 6 6 2 5 4 0
1 3 5 5 4 1 2
3 6 3 6 2 7 5
5 1 6 7 4 4 9
1 9 5 6 3 0 0
5...

output:

impossible

result:

ok impossible

Test #35:

score: 0
Accepted
time: 0ms
memory: 3792kb

input:

45 79
3 2 4 3 1 3 5 1 1 0 1 1 1 0 2 1 1 5 5 7 2 3 7 3 2 2 0 1 2 2 3 1 1 0 1 1 1 4 3 0 1 0 0 6 0 2 0 4 2 4 3 2 0 1 3 1 1 1 1 1 5 4 2 5 5 2 1 1 0 2 5 2 5 3 3 0 1 0 5 2 1
3 1 3 0 7 3 4 5 1 2 1 3 4 5 2 5 2 1 0 8 3 2 4 5 6 5 2 5 1 0 3 2 2 1 3 4 4 6 1 2 1 5 1 2 5 3 6 1 1 5 6 4 5 8 7 3 1 1 0 5 2 2 0 1 5 3 ...

output:

impossible

result:

ok impossible

Test #36:

score: 0
Accepted
time: 0ms
memory: 3596kb

input:

4 9
6 5 0 3 4 1 5 2 9 1 1
8 8 1 7 3 3 2 7 2 3 4
0 3 2 5 2 8 9 8 7 7 7
1 8 6 1 8 7 4 2 2 9 4
7 4 8 0 6 7 8 5 4 0 2
4 6 5 1 8 8 2 4 5 4 4

output:

impossible

result:

ok impossible

Test #37:

score: 0
Accepted
time: 1ms
memory: 3744kb

input:

58 84
4 4 3 2 2 7 2 1 1 1 2 1 3 1 2 1 2 0 2 0 1 3 1 0 1 2 0 2 0 1 2 1 1 1 2 3 3 1 1 1 3 1 1 1 6 6 2 1 4 2 1 0 1 9 4 2 1 3 1 5 1 1 0 2 1 5 2 0 1 0 1 1 3 2 2 2 2 1 3 1 1 4 2 1 1 0
1 2 2 2 4 4 3 1 0 1 2 5 6 1 0 2 4 3 5 3 1 4 4 0 0 3 4 2 1 5 5 2 1 3 3 1 3 3 1 1 2 0 3 1 4 8 7 4 3 2 2 6 2 6 5 6 5 4 2 2 1 ...

output:

impossible

result:

ok impossible

Test #38:

score: 0
Accepted
time: 0ms
memory: 3652kb

input:

6 39
3 5 3 1 4 2 6 2 5 3 4 5 7 7 2 1 3 8 6 6 2 3 8 6 0 0 6 1 2 1 9 6 7 4 5 4 1 4 6 6 7
5 2 4 5 8 4 1 8 3 6 4 6 1 8 4 2 6 1 0 0 4 0 8 6 7 8 8 3 8 7 7 3 7 2 2 5 1 8 5 8 3
0 3 2 1 5 3 6 5 4 1 7 8 6 5 1 8 1 3 9 1 4 4 0 0 7 0 7 3 1 7 9 6 5 2 2 7 3 7 1 3 2
6 1 5 3 8 0 7 2 3 1 1 4 3 5 1 6 7 0 1 4 6 0 7 5 6...

output:

impossible

result:

ok impossible

Test #39:

score: 0
Accepted
time: 1ms
memory: 4044kb

input:

100 100
1 2 3 3 3 2 1 0 1 2 2 1 0 1 1 1 0 1 1 1 0 0 0 0 1 1 1 1 1 2 2 2 2 2 2 1 1 2 3 3 3 2 1 0 0 0 1 2 2 1 1 2 2 1 0 0 0 1 2 3 2 2 1 1 1 2 3 3 3 3 2 2 2 3 2 1 0 0 1 2 2 2 2 3 2 2 1 2 2 2 2 1 1 0 0 1 1 1 1 1 1 0
2 3 4 4 5 5 3 1 2 3 4 2 1 2 2 2 1 3 3 2 1 2 3 2 2 1 1 1 1 3 4 4 3 3 3 2 2 4 5 5 5 4 2 0 ...

output:

XXXXX...XX...X...X......X..X.XX.XX..XXXXX.....XX..XX.....XXX.X..XXXXXX.XXX....XX.XXX.X.XX.X....X..X.
X..XXX..X.X..X..XX..XXX......XX..X..XX.XX....XXX.X..X.X..XXXX....X..XXXX..XXXXX.X.XX.XXXXXXX..XX..X.
.XXX.XX.X.X.XX......X.X.XXX..X.XX.X..X....XXXX....X.XX..X.X.....X.X.X.........X.XXXX....XX...XXXX....

result:

ok correct solution

Test #40:

score: 0
Accepted
time: 0ms
memory: 3660kb

input:

2 3
1 1 2 1 1
1 2 3 2 1
1 2 3 2 1
0 1 1 1 1

output:

impossible

result:

ok impossible

Test #41:

score: 0
Accepted
time: 0ms
memory: 3596kb

input:

2 3
1 1 2 1 1
1 2 3 2 1
1 2 3 2 1
0 1 1 0 0

output:

impossible

result:

ok impossible