Task: | Spin-Pop-Squeeze-Clap |
Sender: | aalto2024c_005 |
Submission time: | 2024-09-18 17:39: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 | 5.75 s | details |
#7 | ACCEPTED | 0.18 s | details |
#8 | ACCEPTED | 3.90 s | details |
#9 | ACCEPTED | 1.51 s | details |
#10 | ACCEPTED | 0.06 s | details |
#11 | ACCEPTED | 1.03 s | details |
#12 | ACCEPTED | 0.67 s | details |
#13 | ACCEPTED | 1.81 s | details |
#14 | ACCEPTED | 0.62 s | details |
#15 | ACCEPTED | 0.21 s | details |
#16 | ACCEPTED | 2.52 s | details |
#17 | ACCEPTED | 1.55 s | details |
#18 | ACCEPTED | 0.15 s | details |
#19 | ACCEPTED | 0.20 s | details |
#20 | ACCEPTED | 0.05 s | details |
#21 | ACCEPTED | 0.06 s | details |
#22 | ACCEPTED | 1.94 s | details |
#23 | ACCEPTED | 1.78 s | details |
#24 | ACCEPTED | 1.09 s | details |
#25 | ACCEPTED | 3.05 s | details |
#26 | ACCEPTED | 4.27 s | details |
#27 | ACCEPTED | 0.81 s | details |
#28 | TIME LIMIT EXCEEDED | -- | details |
#29 | TIME LIMIT EXCEEDED | -- | details |
#30 | ACCEPTED | 3.62 s | details |
#31 | ACCEPTED | 1.82 s | details |
#32 | ACCEPTED | 2.17 s | details |
#33 | ACCEPTED | 3.92 s | details |
#34 | ACCEPTED | 0.53 s | details |
#35 | ACCEPTED | 2.24 s | details |
Code
a = input() b = input() def clap(a): res = '' for i in range(len(a)): res += str((int(a[i]) + 9) % 10) return res def levenstein(a, b): dist = [[0] * (len(b) + 1) for _ in range(len(a) + 1)] for i in range(len(a) + 1): dist[i][0] = i for i in range(len(b) + 1): dist[0][i] = i for i in range(1, len(a) + 1): for j in range(1, len(b) + 1): if a[i - 1] == b[j - 1]: dist[i][j] = dist[i - 1][j - 1] else: dist[i][j] = min([dist[i][j - 1], dist[i - 1][j], dist[i - 1][j - 1]]) + 1 return dist[len(a)][len(b)] res = (len(b) + len(a)) * 2 for i in range(10): res = min(res, levenstein(a, b) + i) b = clap(b) print(res)
Test details
Test 1
Verdict: ACCEPTED
input |
---|
111222 283303 |
correct output |
---|
4 |
user output |
---|
4 |
Test 2
Verdict: ACCEPTED
input |
---|
123123 54545 |
correct output |
---|
4 |
user output |
---|
4 |
Test 3
Verdict: ACCEPTED
input |
---|
111 222 |
correct output |
---|
1 |
user output |
---|
1 |
Test 4
Verdict: ACCEPTED
input |
---|
999 999 |
correct output |
---|
0 |
user output |
---|
0 |
Test 5
Verdict: ACCEPTED
input |
---|
450 57 |
correct output |
---|
2 |
user output |
---|
2 |
Test 6
Verdict: ACCEPTED
input |
---|
660487647593824219489241157815... |
correct output |
---|
674 |
user output |
---|
674 |
Test 7
Verdict: ACCEPTED
input |
---|
914177763170669074391500080636... |
correct output |
---|
130 |
user output |
---|
130 |
Test 8
Verdict: ACCEPTED
input |
---|
011524493909266858784005756682... |
correct output |
---|
681 |
user output |
---|
681 |
Test 9
Verdict: ACCEPTED
input |
---|
982597919074833788762328601290... |
correct output |
---|
717 |
user output |
---|
717 |
Test 10
Verdict: ACCEPTED
input |
---|
416721106840388542143044324451... |
correct output |
---|
215 |
user output |
---|
215 |
Test 11
Verdict: ACCEPTED
input |
---|
458073021573681930364262129972... |
correct output |
---|
473 |
user output |
---|
473 |
Test 12
Verdict: ACCEPTED
input |
---|
917400297550473688139849165156... |
correct output |
---|
699 |
user output |
---|
699 |
Test 13
Verdict: ACCEPTED
input |
---|
260181590830166131860913909960... |
correct output |
---|
584 |
user output |
---|
584 |
Test 14
Verdict: ACCEPTED
input |
---|
562301238360777679361730486761... |
correct output |
---|
284 |
user output |
---|
284 |
Test 15
Verdict: ACCEPTED
input |
---|
954220587915890627622301289161... |
correct output |
---|
416 |
user output |
---|
416 |
Test 16
Verdict: ACCEPTED
input |
---|
067903774208751350629566447245... |
correct output |
---|
442 |
user output |
---|
442 |
Test 17
Verdict: ACCEPTED
input |
---|
877893287921742180967929081003... |
correct output |
---|
358 |
user output |
---|
358 |
Test 18
Verdict: ACCEPTED
input |
---|
485260574793809275253093185610... |
correct output |
---|
442 |
user output |
---|
442 |
Test 19
Verdict: ACCEPTED
input |
---|
423232218340629042147624537896... |
correct output |
---|
192 |
user output |
---|
192 |
Test 20
Verdict: ACCEPTED
input |
---|
983444174766143554582284201195... |
correct output |
---|
83 |
user output |
---|
83 |
Test 21
Verdict: ACCEPTED
input |
---|
308023002531575464533553486397... |
correct output |
---|
984 |
user output |
---|
984 |
Test 22
Verdict: ACCEPTED
input |
---|
774637064330445294039402907794... |
correct output |
---|
544 |
user output |
---|
544 |
Test 23
Verdict: ACCEPTED
input |
---|
645428410366485628023288358114... |
correct output |
---|
378 |
user output |
---|
378 |
Test 24
Verdict: ACCEPTED
input |
---|
175337727474341582323359837344... |
correct output |
---|
695 |
user output |
---|
695 |
Test 25
Verdict: ACCEPTED
input |
---|
081836584929414654154099313187... |
correct output |
---|
493 |
user output |
---|
493 |
Test 26
Verdict: ACCEPTED
input |
---|
241592066112579763355561876139... |
correct output |
---|
630 |
user output |
---|
630 |
Test 27
Verdict: ACCEPTED
input |
---|
664737828830059612330669705871... |
correct output |
---|
559 |
user output |
---|
559 |
Test 28
Verdict: TIME LIMIT EXCEEDED
input |
---|
230972151340592860909446321989... |
correct output |
---|
696 |
user output |
---|
(empty) |
Test 29
Verdict: TIME LIMIT EXCEEDED
input |
---|
410946685234703970117608650309... |
correct output |
---|
691 |
user output |
---|
(empty) |
Test 30
Verdict: ACCEPTED
input |
---|
692323212407710827747149254185... |
correct output |
---|
536 |
user output |
---|
536 |
Test 31
Verdict: ACCEPTED
input |
---|
034704049619193895285878119956... |
correct output |
---|
467 |
user output |
---|
467 |
Test 32
Verdict: ACCEPTED
input |
---|
336980270982636303223976539004... |
correct output |
---|
543 |
user output |
---|
543 |
Test 33
Verdict: ACCEPTED
input |
---|
744311485456233719196607507429... |
correct output |
---|
570 |
user output |
---|
570 |
Test 34
Verdict: ACCEPTED
input |
---|
289232763326229330631165228849... |
correct output |
---|
563 |
user output |
---|
563 |
Test 35
Verdict: ACCEPTED
input |
---|
159941856600173517598637236698... |
correct output |
---|
431 |
user output |
---|
431 |