| Task: | Program |
| Sender: | aalto25e_004 |
| Submission time: | 2025-10-01 17:01:00 +0300 |
| Language: | Python3 (PyPy3) |
| Status: | READY |
| Result: | WRONG ANSWER |
| test | verdict | time | group | |
|---|---|---|---|---|
| #1 | WRONG ANSWER | 0.04 s | details | |
| #2 | ACCEPTED | 0.04 s | details | |
| #3 | WRONG ANSWER | 0.04 s | details | |
| #4 | ACCEPTED | 0.04 s | details | |
| #5 | WRONG ANSWER | 0.04 s | details | |
| #6 | WRONG ANSWER | 0.04 s | details | |
| #7 | ACCEPTED | 0.04 s | details | |
| #8 | ACCEPTED | 0.04 s | details | |
| #9 | ACCEPTED | 0.04 s | details | |
| #10 | WRONG ANSWER | 0.04 s | details | |
| #11 | TIME LIMIT EXCEEDED | -- | details | |
| #12 | TIME LIMIT EXCEEDED | -- | details | |
| #13 | TIME LIMIT EXCEEDED | -- | details | |
| #14 | TIME LIMIT EXCEEDED | -- | details | |
| #15 | TIME LIMIT EXCEEDED | -- | details | |
| #16 | TIME LIMIT EXCEEDED | -- | details | |
| #17 | TIME LIMIT EXCEEDED | -- | details | |
| #18 | TIME LIMIT EXCEEDED | -- | details | |
| #19 | TIME LIMIT EXCEEDED | -- | details | |
| #20 | TIME LIMIT EXCEEDED | -- | details | |
| #21 | RUNTIME ERROR | 0.07 s | details | |
| #22 | RUNTIME ERROR | 0.06 s | details | |
| #23 | RUNTIME ERROR | 0.06 s | details | |
| #24 | RUNTIME ERROR | 0.06 s | details | |
| #25 | RUNTIME ERROR | 0.07 s | details | |
| #26 | RUNTIME ERROR | 0.06 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.06 s | details |
Code
n = int(input())
smallest_op = [float('inf')] * (n+1)
smallest_op[1] = 0
commandes = [[] for _ in range(n+1)]
for i in range(2, n+1):
x = float('inf')
y = float('inf')
if i%2 == 0:
x = smallest_op[i//2]
y = smallest_op[i-3]
if x+1 < smallest_op[i] and x+1 < y+1:
smallest_op[i] = x+1
commandes[i] = commandes[i//2].copy()
commandes[i].append('MUL')
elif y+1 < smallest_op[i]:
smallest_op[i] = y+1
commandes[i] = commandes[i-3].copy()
commandes[i].append('ADD')
if smallest_op[n] == float('inf'):
smallest_op[n] = 0
if smallest_op[n] == 0:
print(0)
else:
print(smallest_op[n]+1)
for i in range(len(commandes[n])-1, -1, -1):
print(commandes[n][i])
print('END')Test details
Test 1
Group:
Verdict: WRONG ANSWER
| input |
|---|
| 58 |
| correct output |
|---|
| 8 MUL ADD MUL ADD ... |
| user output |
|---|
| 8 MUL ADD MUL ADD ... |
Test 2
Group:
Verdict: ACCEPTED
| input |
|---|
| 72 |
| correct output |
|---|
| 0 |
| user output |
|---|
| 0 |
Test 3
Group:
Verdict: WRONG ANSWER
| input |
|---|
| 83 |
| correct output |
|---|
| 8 MUL ADD MUL MUL ... |
| user output |
|---|
| 8 ADD MUL MUL MUL ... |
Test 4
Group:
Verdict: ACCEPTED
| input |
|---|
| 53 |
| correct output |
|---|
| 8 ADD MUL ADD MUL ... |
| user output |
|---|
| 8 ADD MUL ADD MUL ... |
Test 5
Group:
Verdict: WRONG ANSWER
| input |
|---|
| 100 |
| correct output |
|---|
| 8 ADD MUL ADD MUL ... |
| user output |
|---|
| 8 MUL MUL ADD MUL ... |
Test 6
Group:
Verdict: WRONG ANSWER
| input |
|---|
| 64 |
| correct output |
|---|
| 6 ADD MUL MUL MUL ... |
| user output |
|---|
| 6 MUL MUL MUL MUL ... |
Test 7
Group:
Verdict: ACCEPTED
| input |
|---|
| 84 |
| correct output |
|---|
| 0 |
| user output |
|---|
| 0 |
Test 8
Group:
Verdict: ACCEPTED
| input |
|---|
| 60 |
| correct output |
|---|
| 0 |
| user output |
|---|
| 0 |
Test 9
Group:
Verdict: ACCEPTED
| input |
|---|
| 51 |
| correct output |
|---|
| 0 |
| user output |
|---|
| 0 |
Test 10
Group:
Verdict: WRONG ANSWER
| input |
|---|
| 77 |
| correct output |
|---|
| 9 ADD ADD MUL ADD ... |
| user output |
|---|
| 9 ADD MUL ADD MUL ... |
Test 11
Group:
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| 941694 |
| correct output |
|---|
| 0 |
| user output |
|---|
| (empty) |
Test 12
Group:
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| 905674 |
| correct output |
|---|
| 30 MUL ADD MUL ADD ... |
| user output |
|---|
| (empty) |
Test 13
Group:
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| 908426 |
| correct output |
|---|
| 29 ADD MUL ADD MUL ... |
| user output |
|---|
| (empty) |
Test 14
Group:
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| 960500 |
| correct output |
|---|
| 31 ADD ADD MUL MUL ... |
| user output |
|---|
| (empty) |
Test 15
Group:
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| 902101 |
| correct output |
|---|
| 27 MUL ADD MUL ADD ... |
| user output |
|---|
| (empty) |
Test 16
Group:
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| 994208 |
| correct output |
|---|
| 27 ADD ADD MUL MUL ... |
| user output |
|---|
| (empty) |
Test 17
Group:
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| 923538 |
| correct output |
|---|
| 0 |
| user output |
|---|
| (empty) |
Test 18
Group:
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| 950287 |
| correct output |
|---|
| 24 MUL ADD MUL ADD ... |
| user output |
|---|
| (empty) |
Test 19
Group:
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| 950516 |
| correct output |
|---|
| 29 ADD ADD MUL MUL ... |
| user output |
|---|
| (empty) |
Test 20
Group:
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| 921882 |
| correct output |
|---|
| 0 |
| user output |
|---|
| (empty) |
Test 21
Group:
Verdict: RUNTIME ERROR
| input |
|---|
| 933942296856681219 |
| correct output |
|---|
| 0 |
| user output |
|---|
| (empty) |
Error:
Traceback (most recent call last):
File "input/code.py", line 2, in <module>
smallest_op = [float('inf')] * (n+1)
MemoryErrorTest 22
Group:
Verdict: RUNTIME ERROR
| input |
|---|
| 955775764385016720 |
| correct output |
|---|
| 0 |
| user output |
|---|
| (empty) |
Error:
Traceback (most recent call last):
File "input/code.py", line 2, in <module>
smallest_op = [float('inf')] * (n+1)
MemoryErrorTest 23
Group:
Verdict: RUNTIME ERROR
| input |
|---|
| 981578916796073406 |
| correct output |
|---|
| 0 |
| user output |
|---|
| (empty) |
Error:
Traceback (most recent call last):
File "input/code.py", line 2, in <module>
smallest_op = [float('inf')] * (n+1)
MemoryErrorTest 24
Group:
Verdict: RUNTIME ERROR
| input |
|---|
| 927875200723222396 |
| correct output |
|---|
| 94 MUL ADD MUL MUL ... |
| user output |
|---|
| (empty) |
Error:
Traceback (most recent call last):
File "input/code.py", line 2, in <module>
smallest_op = [float('inf')] * (n+1)
MemoryErrorTest 25
Group:
Verdict: RUNTIME ERROR
| input |
|---|
| 990125206148420558 |
| correct output |
|---|
| 84 ADD MUL ADD MUL ... |
| user output |
|---|
| (empty) |
Error:
Traceback (most recent call last):
File "input/code.py", line 2, in <module>
smallest_op = [float('inf')] * (n+1)
MemoryErrorTest 26
Group:
Verdict: RUNTIME ERROR
| input |
|---|
| 964804802247123102 |
| correct output |
|---|
| 0 |
| user output |
|---|
| (empty) |
Error:
Traceback (most recent call last):
File "input/code.py", line 2, in <module>
smallest_op = [float('inf')] * (n+1)
MemoryErrorTest 27
Group:
Verdict: RUNTIME ERROR
| input |
|---|
| 996610423667404231 |
| correct output |
|---|
| 96 MUL ADD MUL ADD ... |
| user output |
|---|
| (empty) |
Error:
Traceback (most recent call last):
File "input/code.py", line 2, in <module>
smallest_op = [float('inf')] * (n+1)
MemoryErrorTest 28
Group:
Verdict: RUNTIME ERROR
| input |
|---|
| 948665008088793691 |
| correct output |
|---|
| 86 MUL ADD MUL ADD ... |
| user output |
|---|
| (empty) |
Error:
Traceback (most recent call last):
File "input/code.py", line 2, in <module>
smallest_op = [float('inf')] * (n+1)
MemoryErrorTest 29
Group:
Verdict: RUNTIME ERROR
| input |
|---|
| 969397787818953279 |
| correct output |
|---|
| 0 |
| user output |
|---|
| (empty) |
Error:
Traceback (most recent call last):
File "input/code.py", line 2, in <module>
smallest_op = [float('inf')] * (n+1)
MemoryErrorTest 30
Group:
Verdict: RUNTIME ERROR
| input |
|---|
| 918471787211371085 |
| correct output |
|---|
| 90 ADD MUL ADD MUL ... |
| user output |
|---|
| (empty) |
Error:
Traceback (most recent call last):
File "input/code.py", line 2, in <module>
smallest_op = [float('inf')] * (n+1)
MemoryError