Submission details
Task:Abandoned warehouse
Sender:jonnymorgan
Submission time:2025-09-08 17:28:36 +0300
Language:Python3 (PyPy3)
Status:READY
Result:
Test results
testverdicttime
#10.06 sdetails
#20.06 sdetails
#30.06 sdetails
#40.06 sdetails
#50.06 sdetails
#60.07 sdetails
#70.06 sdetails
#80.07 sdetails
#90.06 sdetails
#100.07 sdetails
#110.06 sdetails
#120.07 sdetails
#130.06 sdetails
#140.06 sdetails
#150.06 sdetails
#160.07 sdetails

Code

n, m = [int(x) for x in input().split()]

classroom = [[] for i in range(n + 1)]
for i in range(m):
    a, b = [int(x) for x in input().split()]
    classroom[a].append(b)
    classroom[b].append(a)

team = [0] * (n + 1)
print(*classroom)
def assign2(start):
    for i in classroom[start]:
        if not set(classroom[i]).intersection(classroom[start]):
            team[i] = 2
        else:
            return True
    return False

impossible = False
for i in range(1, n + 1):
    if team[i] == 0:
        team[i] = 1
        impossible = assign2(i)
    if impossible:
        break


if not impossible:
    del team[0]
    print(*team)
else:
    print("IMPOSSIBLE")






Test details

Test 1

Verdict:

input
10 10
##.A######
#.##.##.##
#####..###
.#########
...

correct output
NO

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 5, in <module>
    a, b =...

Test 2

Verdict:

input
10 10
B#..##.#..
#....A##..
#.....#..#
.#......#.
...

correct output
NO

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 5, in <module>
    a, b =...

Test 3

Verdict:

input
10 10
...#..A.#.
....B...##
...#......
..........
...

correct output
YES
3
LLD

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 5, in <module>
    a, b =...

Test 4

Verdict:

input
10 10
.#........
..........
..........
........#.
...

correct output
YES
1
R

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 5, in <module>
    a, b =...

Test 5

Verdict:

input
10 10
..........
..........
..........
..........
...

correct output
YES
3
RDD

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 5, in <module>
    a, b =...

Test 6

Verdict:

input
1000 1000
##.###..######.#########.###.#...

correct output
NO

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 5, in <module>
    a, b =...

Test 7

Verdict:

input
1000 1000
####.#.###....#.......##.##.#....

correct output
YES
626
LLLDDRDDDDLDLDDLLLLLDDDDLLDLDL...

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 5, in <module>
    a, b =...

Test 8

Verdict:

input
1000 1000
....#.##......#....#......#......

correct output
YES
364
LULULLULLLULLLLLUULLLLUUULLLLL...

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 5, in <module>
    a, b =...

Test 9

Verdict:

input
1000 1000
.................#......#........

correct output
YES
1003
LLLLLLLLLLLLLLLLLLLLLLLLLDLLLL...

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 5, in <module>
    a, b =...

Test 10

Verdict:

input
1000 1000
.................................

correct output
YES
947
LLLLLLLLLLLLLLLLLLLLLLLLLLLLLL...

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 5, in <module>
    a, b =...

Test 11

Verdict:

input
1000 3
A#B
.#.
.#.
.#.
...

correct output
YES
2000
DDDDDDDDDDDDDDDDDDDDDDDDDDDDDD...

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 5, in <module>
    a, b =...

Test 12

Verdict:

input
3 1000
A................................

correct output
YES
2000
RRRRRRRRRRRRRRRRRRRRRRRRRRRRRR...

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 5, in <module>
    a, b =...

Test 13

Verdict:

input
999 999
A#...#...#...#...#...#...#...#...

correct output
YES
499998
DDDDDDDDDDDDDDDDDDDDDDDDDDDDDD...

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 5, in <module>
    a, b =...

Test 14

Verdict:

input
1 3
A.B

correct output
YES
2
RR

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 5, in <module>
    a, b =...

Test 15

Verdict:

input
2 2
##
AB

correct output
YES
1
R

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 5, in <module>
    a, b =...

Test 16

Verdict:

input
1000 1000
A................................

correct output
YES
1998
RRRRRRRRRRRRRRRRRRRRRRRRRRRRRR...

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 5, in <module>
    a, b =...