Task: | Stone game |
Sender: | ZDHKLV |
Submission time: | 2024-09-02 17:20:39 +0300 |
Language: | Python3 (CPython3) |
Status: | READY |
Result: | TIME LIMIT EXCEEDED |
test | verdict | time | |
---|---|---|---|
#1 | ACCEPTED | 0.02 s | details |
#2 | ACCEPTED | 0.02 s | details |
#3 | ACCEPTED | 0.02 s | details |
#4 | ACCEPTED | 0.02 s | details |
#5 | ACCEPTED | 0.02 s | details |
#6 | ACCEPTED | 0.02 s | details |
#7 | ACCEPTED | 0.02 s | details |
#8 | ACCEPTED | 0.02 s | details |
#9 | ACCEPTED | 0.02 s | details |
#10 | ACCEPTED | 0.02 s | details |
#11 | ACCEPTED | 0.02 s | details |
#12 | ACCEPTED | 0.02 s | details |
#13 | ACCEPTED | 0.02 s | details |
#14 | ACCEPTED | 0.02 s | details |
#15 | ACCEPTED | 0.02 s | details |
#16 | ACCEPTED | 0.02 s | details |
#17 | ACCEPTED | 0.02 s | details |
#18 | ACCEPTED | 0.02 s | details |
#19 | ACCEPTED | 0.02 s | details |
#20 | ACCEPTED | 0.02 s | details |
#21 | TIME LIMIT EXCEEDED | -- | details |
#22 | TIME LIMIT EXCEEDED | -- | details |
#23 | ACCEPTED | 0.06 s | details |
#24 | ACCEPTED | 0.06 s | details |
#25 | TIME LIMIT EXCEEDED | -- | details |
#26 | ACCEPTED | 0.02 s | details |
#27 | ACCEPTED | 0.27 s | details |
#28 | ACCEPTED | 0.09 s | details |
#29 | ACCEPTED | 0.04 s | details |
#30 | ACCEPTED | 0.31 s | details |
#31 | TIME LIMIT EXCEEDED | -- | details |
#32 | TIME LIMIT EXCEEDED | -- | details |
#33 | ACCEPTED | 0.34 s | details |
#34 | ACCEPTED | 0.33 s | details |
#35 | TIME LIMIT EXCEEDED | -- | details |
#36 | ACCEPTED | 0.03 s | details |
#37 | TIME LIMIT EXCEEDED | -- | details |
#38 | ACCEPTED | 0.58 s | details |
#39 | ACCEPTED | 0.13 s | details |
#40 | TIME LIMIT EXCEEDED | -- | details |
#41 | TIME LIMIT EXCEEDED | -- | details |
#42 | TIME LIMIT EXCEEDED | -- | details |
#43 | TIME LIMIT EXCEEDED | -- | details |
#44 | TIME LIMIT EXCEEDED | -- | details |
#45 | TIME LIMIT EXCEEDED | -- | details |
#46 | ACCEPTED | 0.05 s | details |
#47 | TIME LIMIT EXCEEDED | -- | details |
#48 | TIME LIMIT EXCEEDED | -- | details |
#49 | ACCEPTED | 0.31 s | details |
#50 | TIME LIMIT EXCEEDED | -- | details |
#51 | ACCEPTED | 0.03 s | details |
#52 | ACCEPTED | 0.08 s | details |
#53 | TIME LIMIT EXCEEDED | -- | details |
#54 | TIME LIMIT EXCEEDED | -- | details |
#55 | TIME LIMIT EXCEEDED | -- | details |
#56 | TIME LIMIT EXCEEDED | -- | details |
#57 | TIME LIMIT EXCEEDED | -- | details |
#58 | ACCEPTED | 0.98 s | details |
#59 | ACCEPTED | 0.63 s | details |
#60 | TIME LIMIT EXCEEDED | -- | details |
Code
UOLEVI = 0 MAIJA = 1 def play(A: int, B: int): seen = {} def play_rec(a: int, b: int, player: int) -> int: if f"{a};{b};{player}" in seen: return -1 # discard for x in range(1, a+1): rec = play_rec(a - x, b, (player+1) % 2) if rec == player: seen[f"{a};{b};{player}"] = player return player for y in range(1, b+1): rec = play_rec(a, b - y, (player+1) % 2) if rec == player: seen[f"{a};{b};{player}"] = player return player # put for x in range(1, a+1): rec = play_rec(a - x, b + x, (player+1) % 2) if rec == player: seen[f"{a};{b};{player}"] = player return player for y in range(1, b+1): rec = play_rec(a + y, b - y, (player+1) % 2) if rec == player: seen[f"{a};{b};{player}"] = player return player return (player+1) % 2 result = play_rec(A, B, UOLEVI) if result == UOLEVI: print("Uolevi") elif result == MAIJA: print("Maija") else: print("Draw") if __name__ == "__main__": import sys a, b = input("").split(" ") a, b = int(a), int(b) play(a, b)
Test details
Test 1
Verdict: ACCEPTED
input |
---|
3 4 |
correct output |
---|
Uolevi |
user output |
---|
Uolevi |
Test 2
Verdict: ACCEPTED
input |
---|
5 5 |
correct output |
---|
Maija |
user output |
---|
Maija |
Test 3
Verdict: ACCEPTED
input |
---|
1 1 |
correct output |
---|
Maija |
user output |
---|
Maija |
Test 4
Verdict: ACCEPTED
input |
---|
1 4 |
correct output |
---|
Uolevi |
user output |
---|
Uolevi |
Test 5
Verdict: ACCEPTED
input |
---|
5 3 |
correct output |
---|
Uolevi |
user output |
---|
Uolevi |
Test 6
Verdict: ACCEPTED
input |
---|
1 1 |
correct output |
---|
Maija |
user output |
---|
Maija |
Test 7
Verdict: ACCEPTED
input |
---|
5 2 |
correct output |
---|
Uolevi |
user output |
---|
Uolevi |
Test 8
Verdict: ACCEPTED
input |
---|
2 2 |
correct output |
---|
Maija |
user output |
---|
Maija |
Test 9
Verdict: ACCEPTED
input |
---|
1 5 |
correct output |
---|
Uolevi |
user output |
---|
Uolevi |
Test 10
Verdict: ACCEPTED
input |
---|
2 2 |
correct output |
---|
Maija |
user output |
---|
Maija |
Test 11
Verdict: ACCEPTED
input |
---|
6 8 |
correct output |
---|
Uolevi |
user output |
---|
Uolevi |
Test 12
Verdict: ACCEPTED
input |
---|
10 10 |
correct output |
---|
Maija |
user output |
---|
Maija |
Test 13
Verdict: ACCEPTED
input |
---|
2 2 |
correct output |
---|
Maija |
user output |
---|
Maija |
Test 14
Verdict: ACCEPTED
input |
---|
1 8 |
correct output |
---|
Uolevi |
user output |
---|
Uolevi |
Test 15
Verdict: ACCEPTED
input |
---|
10 6 |
correct output |
---|
Uolevi |
user output |
---|
Uolevi |
Test 16
Verdict: ACCEPTED
input |
---|
1 1 |
correct output |
---|
Maija |
user output |
---|
Maija |
Test 17
Verdict: ACCEPTED
input |
---|
10 4 |
correct output |
---|
Uolevi |
user output |
---|
Uolevi |
Test 18
Verdict: ACCEPTED
input |
---|
3 3 |
correct output |
---|
Maija |
user output |
---|
Maija |
Test 19
Verdict: ACCEPTED
input |
---|
1 10 |
correct output |
---|
Uolevi |
user output |
---|
Uolevi |
Test 20
Verdict: ACCEPTED
input |
---|
4 4 |
correct output |
---|
Maija |
user output |
---|
Maija |
Test 21
Verdict: TIME LIMIT EXCEEDED
input |
---|
60 72 |
correct output |
---|
Uolevi |
user output |
---|
(empty) |
Test 22
Verdict: TIME LIMIT EXCEEDED
input |
---|
100 100 |
correct output |
---|
Maija |
user output |
---|
(empty) |
Test 23
Verdict: ACCEPTED
input |
---|
19 19 |
correct output |
---|
Maija |
user output |
---|
Maija |
Test 24
Verdict: ACCEPTED
input |
---|
8 71 |
correct output |
---|
Uolevi |
user output |
---|
Uolevi |
Test 25
Verdict: TIME LIMIT EXCEEDED
input |
---|
91 55 |
correct output |
---|
Uolevi |
user output |
---|
(empty) |
Test 26
Verdict: ACCEPTED
input |
---|
6 6 |
correct output |
---|
Maija |
user output |
---|
Maija |
Test 27
Verdict: ACCEPTED
input |
---|
95 34 |
correct output |
---|
Uolevi |
user output |
---|
Uolevi |
Test 28
Verdict: ACCEPTED
input |
---|
23 23 |
correct output |
---|
Maija |
user output |
---|
Maija |
Test 29
Verdict: ACCEPTED
input |
---|
2 97 |
correct output |
---|
Uolevi |
user output |
---|
Uolevi |
Test 30
Verdict: ACCEPTED
input |
---|
37 37 |
correct output |
---|
Maija |
user output |
---|
Maija |
Test 31
Verdict: TIME LIMIT EXCEEDED
input |
---|
119 144 |
correct output |
---|
Uolevi |
user output |
---|
(empty) |
Test 32
Verdict: TIME LIMIT EXCEEDED
input |
---|
200 200 |
correct output |
---|
Maija |
user output |
---|
(empty) |
Test 33
Verdict: ACCEPTED
input |
---|
38 38 |
correct output |
---|
Maija |
user output |
---|
Maija |
Test 34
Verdict: ACCEPTED
input |
---|
15 142 |
correct output |
---|
Uolevi |
user output |
---|
Uolevi |
Test 35
Verdict: TIME LIMIT EXCEEDED
input |
---|
181 110 |
correct output |
---|
Uolevi |
user output |
---|
(empty) |
Test 36
Verdict: ACCEPTED
input |
---|
12 12 |
correct output |
---|
Maija |
user output |
---|
Maija |
Test 37
Verdict: TIME LIMIT EXCEEDED
input |
---|
190 67 |
correct output |
---|
Uolevi |
user output |
---|
(empty) |
Test 38
Verdict: ACCEPTED
input |
---|
46 46 |
correct output |
---|
Maija |
user output |
---|
Maija |
Test 39
Verdict: ACCEPTED
input |
---|
3 194 |
correct output |
---|
Uolevi |
user output |
---|
Uolevi |
Test 40
Verdict: TIME LIMIT EXCEEDED
input |
---|
73 73 |
correct output |
---|
Maija |
user output |
---|
(empty) |
Test 41
Verdict: TIME LIMIT EXCEEDED
input |
---|
178 215 |
correct output |
---|
Uolevi |
user output |
---|
(empty) |
Test 42
Verdict: TIME LIMIT EXCEEDED
input |
---|
300 300 |
correct output |
---|
Maija |
user output |
---|
(empty) |
Test 43
Verdict: TIME LIMIT EXCEEDED
input |
---|
56 56 |
correct output |
---|
Maija |
user output |
---|
(empty) |
Test 44
Verdict: TIME LIMIT EXCEEDED
input |
---|
22 213 |
correct output |
---|
Uolevi |
user output |
---|
(empty) |
Test 45
Verdict: TIME LIMIT EXCEEDED
input |
---|
271 165 |
correct output |
---|
Uolevi |
user output |
---|
(empty) |
Test 46
Verdict: ACCEPTED
input |
---|
17 17 |
correct output |
---|
Maija |
user output |
---|
Maija |
Test 47
Verdict: TIME LIMIT EXCEEDED
input |
---|
285 100 |
correct output |
---|
Uolevi |
user output |
---|
(empty) |
Test 48
Verdict: TIME LIMIT EXCEEDED
input |
---|
69 69 |
correct output |
---|
Maija |
user output |
---|
(empty) |
Test 49
Verdict: ACCEPTED
input |
---|
4 291 |
correct output |
---|
Uolevi |
user output |
---|
Uolevi |
Test 50
Verdict: TIME LIMIT EXCEEDED
input |
---|
110 110 |
correct output |
---|
Maija |
user output |
---|
(empty) |
Test 51
Verdict: ACCEPTED
input |
---|
90 7 |
correct output |
---|
Uolevi |
user output |
---|
Uolevi |
Test 52
Verdict: ACCEPTED
input |
---|
21 21 |
correct output |
---|
Maija |
user output |
---|
Maija |
Test 53
Verdict: TIME LIMIT EXCEEDED
input |
---|
134 134 |
correct output |
---|
Maija |
user output |
---|
(empty) |
Test 54
Verdict: TIME LIMIT EXCEEDED
input |
---|
183 72 |
correct output |
---|
Uolevi |
user output |
---|
(empty) |
Test 55
Verdict: TIME LIMIT EXCEEDED
input |
---|
277 232 |
correct output |
---|
Uolevi |
user output |
---|
(empty) |
Test 56
Verdict: TIME LIMIT EXCEEDED
input |
---|
245 54 |
correct output |
---|
Uolevi |
user output |
---|
(empty) |
Test 57
Verdict: TIME LIMIT EXCEEDED
input |
---|
98 98 |
correct output |
---|
Maija |
user output |
---|
(empty) |
Test 58
Verdict: ACCEPTED
input |
---|
55 55 |
correct output |
---|
Maija |
user output |
---|
Maija |
Test 59
Verdict: ACCEPTED
input |
---|
23 152 |
correct output |
---|
Uolevi |
user output |
---|
Uolevi |
Test 60
Verdict: TIME LIMIT EXCEEDED
input |
---|
130 130 |
correct output |
---|
Maija |
user output |
---|
(empty) |