| Task: | Hiitism |
| Sender: | Viestipojat |
| Submission time: | 2024-11-16 14:28:24 +0200 |
| Language: | Python3 (PyPy3) |
| Status: | READY |
| Result: | RUNTIME ERROR |
| test | verdict | time | |
|---|---|---|---|
| #1 | ACCEPTED | 0.04 s | details |
| #2 | ACCEPTED | 0.05 s | details |
| #3 | RUNTIME ERROR | 0.07 s | details |
| #4 | RUNTIME ERROR | 0.07 s | details |
| #5 | RUNTIME ERROR | 0.07 s | details |
| #6 | RUNTIME ERROR | 0.07 s | details |
| #7 | RUNTIME ERROR | 0.07 s | details |
| #8 | RUNTIME ERROR | 0.07 s | details |
| #9 | RUNTIME ERROR | 0.07 s | details |
| #10 | RUNTIME ERROR | 0.07 s | details |
| #11 | RUNTIME ERROR | 0.07 s | details |
| #12 | RUNTIME ERROR | 0.08 s | details |
| #13 | RUNTIME ERROR | 0.07 s | details |
| #14 | RUNTIME ERROR | 0.07 s | details |
| #15 | RUNTIME ERROR | 0.07 s | details |
| #16 | RUNTIME ERROR | 0.07 s | details |
| #17 | RUNTIME ERROR | 0.07 s | details |
| #18 | RUNTIME ERROR | 0.07 s | details |
| #19 | RUNTIME ERROR | 0.07 s | details |
| #20 | RUNTIME ERROR | 0.07 s | details |
| #21 | RUNTIME ERROR | 0.07 s | details |
| #22 | RUNTIME ERROR | 0.07 s | details |
| #23 | RUNTIME ERROR | 0.07 s | details |
| #24 | RUNTIME ERROR | 0.08 s | details |
| #25 | RUNTIME ERROR | 0.07 s | details |
| #26 | RUNTIME ERROR | 0.08 s | details |
| #27 | RUNTIME ERROR | 0.07 s | details |
| #28 | RUNTIME ERROR | 0.07 s | details |
| #29 | RUNTIME ERROR | 0.07 s | details |
| #30 | RUNTIME ERROR | 0.07 s | details |
Code
#cs, rs = [int(x) for x in input().split(" ") if x != ""]
lines = [l for l in open(0).read().split("\n") if l != '']
cs, rs = [int(x) for x in lines[0] if x != " "]
m = [list(x) for x in lines[1:] if x != '']
actions = []
removed_cols = set()
removed_rows = set()
sol = False
while not sol:
cut = False
for r in [x for x in range(0, rs) if x not in removed_rows]:
valid_idx = [x for x in range(0, cs) if x not in removed_cols]
first = valid_idx[0]
if m[r][first] != '.' and all(map(lambda x: m[r][x] == m[r][first], valid_idx)):
#cut r
cut = True
actions.append(f"R {r+1} {m[r][first]}")
removed_rows.add(r)
break
if not cut:
for c in [x for x in range(0, cs) if x not in removed_cols]:
valid_idx = [x for x in range(0, rs) if x not in removed_rows]
first = valid_idx[0]
if m[first][c] != '.' and all(map(lambda x: m[x][c] == m[first][c], valid_idx)):
cut = True
actions.append(f"C {c+1} {m[first][c]}")
removed_cols.add(c)
break
if not cut:
break
sol = True
for (i, r) in enumerate(m):
if i in removed_rows:
continue
for (i, c) in enumerate(r):
if i in removed_cols:
continue
if c != '.':
sol = False
break
if not sol:
break
if sol:
print(len(actions))
print("\n".join(reversed(actions)))
else:
print("Impossible")
Test details
Test 1
Verdict: ACCEPTED
| input |
|---|
| 3 3 .H. IHI TTT |
| correct output |
|---|
| 3 R 2 I C 2 H R 3 T |
| user output |
|---|
| 3 R 2 I C 2 H R 3 T |
Test 2
Verdict: ACCEPTED
| input |
|---|
| 2 2 .H IH |
| correct output |
|---|
| 2 R 2 I C 2 H |
| user output |
|---|
| 2 R 2 I C 2 H |
Test 3
Verdict: RUNTIME ERROR
| input |
|---|
| 10 10 T.TIH..... IIIIIIIIII T.TIH..... TIIIHIIIII ... |
| correct output |
|---|
| 7 C 3 T R 10 I R 4 I C 5 H ... |
| user output |
|---|
| (empty) |
Error:
Traceback (most recent call last):
File "input/code.py", line 5, in <module>
cs, rs = [int(x) for x in lines[0] if x != " "]
ValueError: too many values to unpack (expected 2)Test 4
Verdict: RUNTIME ERROR
| input |
|---|
| 100 100 .............H........I.....IT... |
| correct output |
|---|
| 19 R 3 T C 44 H R 34 I C 30 T ... |
| user output |
|---|
| (empty) |
Error:
Traceback (most recent call last):
File "input/code.py", line 5, in <module>
cs, rs = [int(x) for x in lines[0] if x != " "]
ValueError: too many values to unpack (expected 2)Test 5
Verdict: RUNTIME ERROR
| input |
|---|
| 100 100 .........................H....... |
| correct output |
|---|
| Impossible |
| user output |
|---|
| (empty) |
Error:
Traceback (most recent call last):
File "input/code.py", line 5, in <module>
cs, rs = [int(x) for x in lines[0] if x != " "]
ValueError: too many values to unpack (expected 2)Test 6
Verdict: RUNTIME ERROR
| input |
|---|
| 1000 1000 H.II..T.I.IH..I..H.I..I..ITHH.... |
| correct output |
|---|
| Impossible |
| user output |
|---|
| (empty) |
Error:
Traceback (most recent call last):
File "input/code.py", line 5, in <module>
cs, rs = [int(x) for x in lines[0] if x != " "]
ValueError: too many values to unpack (expected 2)Test 7
Verdict: RUNTIME ERROR
| input |
|---|
| 1000 1000 HHHIHHHHHHHHHHHHIHHHHHHHHHHHHH... |
| correct output |
|---|
| Impossible |
| user output |
|---|
| (empty) |
Error:
Traceback (most recent call last):
File "input/code.py", line 5, in <module>
cs, rs = [int(x) for x in lines[0] if x != " "]
ValueError: too many values to unpack (expected 2)Test 8
Verdict: RUNTIME ERROR
| input |
|---|
| 1000 1000 IHIHTI.T.H..IHHIIT.I.TT.HH.HI.... |
| correct output |
|---|
| 1552 C 822 I C 83 T C 55 I R 984 H ... |
| user output |
|---|
| (empty) |
Error:
Traceback (most recent call last):
File "input/code.py", line 5, in <module>
cs, rs = [int(x) for x in lines[0] if x != " "]
ValueError: too many values to unpack (expected 2)Test 9
Verdict: RUNTIME ERROR
| input |
|---|
| 1000 1000 HHHHHHHHHHHHHHHHHHHHHIHHHHHHHH... |
| correct output |
|---|
| 1727 R 500 I C 938 H C 804 H R 263 H ... |
| user output |
|---|
| (empty) |
Error:
Traceback (most recent call last):
File "input/code.py", line 5, in <module>
cs, rs = [int(x) for x in lines[0] if x != " "]
ValueError: too many values to unpack (expected 2)Test 10
Verdict: RUNTIME ERROR
| input |
|---|
| 1000 1000 TITTTHTITTHTHTHITTTTTTTHTHTTTI... |
| correct output |
|---|
| 1856 C 22 H R 531 T C 412 H C 288 H ... |
| user output |
|---|
| (empty) |
Error:
Traceback (most recent call last):
File "input/code.py", line 5, in <module>
cs, rs = [int(x) for x in lines[0] if x != " "]
ValueError: too many values to unpack (expected 2)Test 11
Verdict: RUNTIME ERROR
| input |
|---|
| 1000 1000 IHHTTTTHTIIIHTTTTHTIITTTHHITIT... |
| correct output |
|---|
| 1826 R 200 H R 167 I C 445 I C 355 I ... |
| user output |
|---|
| (empty) |
Error:
Traceback (most recent call last):
File "input/code.py", line 5, in <module>
cs, rs = [int(x) for x in lines[0] if x != " "]
ValueError: too many values to unpack (expected 2)Test 12
Verdict: RUNTIME ERROR
| input |
|---|
| 1000 1000 TTTTTITTTHTHTITIIHTIITIHTTIHTT... |
| correct output |
|---|
| Impossible |
| user output |
|---|
| (empty) |
Error:
Traceback (most recent call last):
File "input/code.py", line 5, in <module>
cs, rs = [int(x) for x in lines[0] if x != " "]
ValueError: too many values to unpack (expected 2)Test 13
Verdict: RUNTIME ERROR
| input |
|---|
| 1000 1000 TITHITITIITTIIIIIHIIIIHTIIIHTI... |
| correct output |
|---|
| Impossible |
| user output |
|---|
| (empty) |
Error:
Traceback (most recent call last):
File "input/code.py", line 5, in <module>
cs, rs = [int(x) for x in lines[0] if x != " "]
ValueError: too many values to unpack (expected 2)Test 14
Verdict: RUNTIME ERROR
| input |
|---|
| 1000 1000 TTTTTTTTTTTTTTTTTTTITTTTTTTITT... |
| correct output |
|---|
| Impossible |
| user output |
|---|
| (empty) |
Error:
Traceback (most recent call last):
File "input/code.py", line 5, in <module>
cs, rs = [int(x) for x in lines[0] if x != " "]
ValueError: too many values to unpack (expected 2)Test 15
Verdict: RUNTIME ERROR
| input |
|---|
| 1000 1000 IHTHHHIHIIIHHTTHHHHIHIIHHIHHHH... |
| correct output |
|---|
| Impossible |
| user output |
|---|
| (empty) |
Error:
Traceback (most recent call last):
File "input/code.py", line 5, in <module>
cs, rs = [int(x) for x in lines[0] if x != " "]
ValueError: too many values to unpack (expected 2)Test 16
Verdict: RUNTIME ERROR
| input |
|---|
| 1000 500 HIHHTHTITTHIHTHTTHIHTTIHTTHHTH... |
| correct output |
|---|
| 1417 C 75 I R 430 T C 195 H R 441 I ... |
| user output |
|---|
| (empty) |
Error:
Traceback (most recent call last):
File "input/code.py", line 5, in <module>
cs, rs = [int(x) for x in lines[0] if x != " "]
ValueError: too many values to unpack (expected 2)Test 17
Verdict: RUNTIME ERROR
| input |
|---|
| 500 1000 IHIIIHIIHIIIIIHIHHIIIIIIIIIIII... |
| correct output |
|---|
| 1418 C 971 T C 744 I C 654 I C 540 T ... |
| user output |
|---|
| (empty) |
Error:
Traceback (most recent call last):
File "input/code.py", line 5, in <module>
cs, rs = [int(x) for x in lines[0] if x != " "]
ValueError: too many values to unpack (expected 2)Test 18
Verdict: RUNTIME ERROR
| input |
|---|
| 1000 500 IIIIIIIIIIIIIIITIIIIIIITTIIIII... |
| correct output |
|---|
| Impossible |
| user output |
|---|
| (empty) |
Error:
Traceback (most recent call last):
File "input/code.py", line 5, in <module>
cs, rs = [int(x) for x in lines[0] if x != " "]
ValueError: too many values to unpack (expected 2)Test 19
Verdict: RUNTIME ERROR
| input |
|---|
| 500 1000 HIITITHHHHIHHIHHTHIIIHHHHTHTHH... |
| correct output |
|---|
| Impossible |
| user output |
|---|
| (empty) |
Error:
Traceback (most recent call last):
File "input/code.py", line 5, in <module>
cs, rs = [int(x) for x in lines[0] if x != " "]
ValueError: too many values to unpack (expected 2)Test 20
Verdict: RUNTIME ERROR
| input |
|---|
| 1000 1000 TIITIIIIIIIIIIIIIIIIIHIHIIIIII... |
| correct output |
|---|
| Impossible |
| user output |
|---|
| (empty) |
Error:
Traceback (most recent call last):
File "input/code.py", line 5, in <module>
cs, rs = [int(x) for x in lines[0] if x != " "]
ValueError: too many values to unpack (expected 2)Test 21
Verdict: RUNTIME ERROR
| input |
|---|
| 1000 1000 TTHTTTTTHTTTHTTTTTTTTHHTTTTTIT... |
| correct output |
|---|
| Impossible |
| user output |
|---|
| (empty) |
Error:
Traceback (most recent call last):
File "input/code.py", line 5, in <module>
cs, rs = [int(x) for x in lines[0] if x != " "]
ValueError: too many values to unpack (expected 2)Test 22
Verdict: RUNTIME ERROR
| input |
|---|
| 1000 1000 IHIIIIITHIIIHIHHHITHIIIIHTTIHI... |
| correct output |
|---|
| Impossible |
| user output |
|---|
| (empty) |
Error:
Traceback (most recent call last):
File "input/code.py", line 5, in <module>
cs, rs = [int(x) for x in lines[0] if x != " "]
ValueError: too many values to unpack (expected 2)Test 23
Verdict: RUNTIME ERROR
| input |
|---|
| 1000 1000 TTHIHIITHTI.HHIHHITIHIHIHIITIH... |
| correct output |
|---|
| Impossible |
| user output |
|---|
| (empty) |
Error:
Traceback (most recent call last):
File "input/code.py", line 5, in <module>
cs, rs = [int(x) for x in lines[0] if x != " "]
ValueError: too many values to unpack (expected 2)Test 24
Verdict: RUNTIME ERROR
| input |
|---|
| 1000 1000 IHIHIIIIIIIIIHIIIHIHIITIHIIIII... |
| correct output |
|---|
| Impossible |
| user output |
|---|
| (empty) |
Error:
Traceback (most recent call last):
File "input/code.py", line 5, in <module>
cs, rs = [int(x) for x in lines[0] if x != " "]
ValueError: too many values to unpack (expected 2)Test 25
Verdict: RUNTIME ERROR
| input |
|---|
| 1000 500 HIHITTIHITHHHTITHIHHHTHHIHHIII... |
| correct output |
|---|
| Impossible |
| user output |
|---|
| (empty) |
Error:
Traceback (most recent call last):
File "input/code.py", line 5, in <module>
cs, rs = [int(x) for x in lines[0] if x != " "]
ValueError: too many values to unpack (expected 2)Test 26
Verdict: RUNTIME ERROR
| input |
|---|
| 500 1000 HHHHHHHHHHHHHHHHHHHHHHHHHHHHHH... |
| correct output |
|---|
| Impossible |
| user output |
|---|
| (empty) |
Error:
Traceback (most recent call last):
File "input/code.py", line 5, in <module>
cs, rs = [int(x) for x in lines[0] if x != " "]
ValueError: too many values to unpack (expected 2)Test 27
Verdict: RUNTIME ERROR
| input |
|---|
| 1000 500 TTTTIHTTTHTTHTITTTTHTHTTHTITTI... |
| correct output |
|---|
| Impossible |
| user output |
|---|
| (empty) |
Error:
Traceback (most recent call last):
File "input/code.py", line 5, in <module>
cs, rs = [int(x) for x in lines[0] if x != " "]
ValueError: too many values to unpack (expected 2)Test 28
Verdict: RUNTIME ERROR
| input |
|---|
| 500 1000 HTIIIHIIIHITIHIIIIIIHTIIIIITHI... |
| correct output |
|---|
| Impossible |
| user output |
|---|
| (empty) |
Error:
Traceback (most recent call last):
File "input/code.py", line 5, in <module>
cs, rs = [int(x) for x in lines[0] if x != " "]
ValueError: too many values to unpack (expected 2)Test 29
Verdict: RUNTIME ERROR
| input |
|---|
| 1000 1000 ................................. |
| correct output |
|---|
| 0 |
| user output |
|---|
| (empty) |
Error:
Traceback (most recent call last):
File "input/code.py", line 5, in <module>
cs, rs = [int(x) for x in lines[0] if x != " "]
ValueError: too many values to unpack (expected 2)Test 30
Verdict: RUNTIME ERROR
| input |
|---|
| 1000 1000 ................................. |
| correct output |
|---|
| 1 C 562 T |
| user output |
|---|
| (empty) |
Error:
Traceback (most recent call last):
File "input/code.py", line 5, in <module>
cs, rs = [int(x) for x in lines[0] if x != " "]
ValueError: too many values to unpack (expected 2)