CSES - Aalto Competitive Programming 2024 - wk8 - Wed - Results
Submission details
Task:A TIMES B!
Sender:aalto2024i_005
Submission time:2024-10-30 16:44:04 +0200
Language:Python3 (PyPy3)
Status:READY
Result:
Test results
testverdicttime
#10.06 sdetails
#20.06 sdetails
#30.07 sdetails
#40.07 sdetails
#50.06 sdetails
#60.06 sdetails
#70.07 sdetails
#80.07 sdetails
#90.07 sdetails
#100.07 sdetails
#110.06 sdetails
#120.07 sdetails
#130.06 sdetails
#140.07 sdetails
#150.07 sdetails
#160.07 sdetails
#170.06 sdetails
#180.06 sdetails
#190.06 sdetails
#200.06 sdetails
#210.07 sdetails
#220.06 sdetails
#230.06 sdetails
#240.06 sdetails
#250.06 sdetails
#260.07 sdetails
#270.06 sdetails
#280.07 sdetails
#290.06 sdetails
#300.06 sdetails
#310.06 sdetails
#320.07 sdetails
#330.07 sdetails
#340.06 sdetails
#350.07 sdetails
#360.06 sdetails
#370.07 sdetails
#380.07 sdetails
#390.07 sdetails
#400.06 sdetails
#410.07 sdetails
#420.06 sdetails
#430.07 sdetails
#440.06 sdetails
#450.06 sdetails
#460.07 sdetails
#470.07 sdetails
#480.06 sdetails
#490.07 sdetails
#500.06 sdetails
#510.07 sdetails
#520.06 sdetails
#530.06 sdetails
#540.07 sdetails
#550.06 sdetails
#560.06 sdetails
#570.07 sdetails
#580.07 sdetails
#590.06 sdetails
#600.07 sdetails
#610.06 sdetails
#620.06 sdetails
#630.07 sdetails
#640.06 sdetails
#650.06 sdetails

Code

from scipy import signal
import sys


def convolve(a, b):
    k = len(a)
    m = len(b)
    n = k + m - 1
    res = [0 for _ in range(n)]
    for i in range(n):
        s = 0
        for j in range(max(0, i - m), i + 1):
            if j < k and (i - j) < m:
                s += a[j] * b[i - j]
        res[i] = s
    return res

def carry(res):
    c = 0
    # print(res)
    for i in range(len(res) - 1, -1, -1):
        res[i] = res[i] + c
        c = res[i] // 10
        res[i] = res[i] % 10
    result = [c]
    result.extend(res)
    return result


input = sys.stdin.readline
a = list(map(int, input().strip()))
b = list(map(int, input().strip()))
r = convolve(a, b)
print(''.join(map(str, carry(r))))

Test details

Test 1

Verdict:

input
8
5

correct output
40

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 1, in <module>
    from sc...

Test 2

Verdict:

input
9
1

correct output
9

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 1, in <module>
    from sc...

Test 3

Verdict:

input
9
5

correct output
45

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 1, in <module>
    from sc...

Test 4

Verdict:

input
2
5

correct output
10

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 1, in <module>
    from sc...

Test 5

Verdict:

input
8
7

correct output
56

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 1, in <module>
    from sc...

Test 6

Verdict:

input
48
92

correct output
4416

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 1, in <module>
    from sc...

Test 7

Verdict:

input
1
40

correct output
40

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 1, in <module>
    from sc...

Test 8

Verdict:

input
97
74

correct output
7178

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 1, in <module>
    from sc...

Test 9

Verdict:

input
58
8

correct output
464

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 1, in <module>
    from sc...

Test 10

Verdict:

input
15
24

correct output
360

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 1, in <module>
    from sc...

Test 11

Verdict:

input
4
7

correct output
28

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 1, in <module>
    from sc...

Test 12

Verdict:

input
906
417

correct output
377802

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 1, in <module>
    from sc...

Test 13

Verdict:

input
778
105

correct output
81690

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 1, in <module>
    from sc...

Test 14

Verdict:

input
2
989

correct output
1978

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 1, in <module>
    from sc...

Test 15

Verdict:

input
2830
5329

correct output
15081070

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 1, in <module>
    from sc...

Test 16

Verdict:

input
9
51382

correct output
462438

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 1, in <module>
    from sc...

Test 17

Verdict:

input
25053
71372

correct output
1788082716

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 1, in <module>
    from sc...

Test 18

Verdict:

input
258180
674616

correct output
174172358880

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 1, in <module>
    from sc...

Test 19

Verdict:

input
8821
2

correct output
17642

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 1, in <module>
    from sc...

Test 20

Verdict:

input
1742712
9600618

correct output
16731112196016

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 1, in <module>
    from sc...

Test 21

Verdict:

input
8898606
2936506

correct output
26130809910636

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 1, in <module>
    from sc...

Test 22

Verdict:

input
82670092
60138633

correct output
4971666322864236

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 1, in <module>
    from sc...

Test 23

Verdict:

input
54746871
83822602

correct output
4589025178578342

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 1, in <module>
    from sc...

Test 24

Verdict:

input
477252461
1032684

correct output
492850980435324

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 1, in <module>
    from sc...

Test 25

Verdict:

input
5932935
379

correct output
2248582365

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 1, in <module>
    from sc...

Test 26

Verdict:

input
620114
3126641

correct output
1938873857074

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 1, in <module>
    from sc...

Test 27

Verdict:

input
452757081
222748761

correct output
100851078826726641

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 1, in <module>
    from sc...

Test 28

Verdict:

input
689748332
888826746

correct output
613066765490487672

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 1, in <module>
    from sc...

Test 29

Verdict:

input
111337
25

correct output
2783425

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 1, in <module>
    from sc...

Test 30

Verdict:

input
809
84435378

correct output
68308220802

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 1, in <module>
    from sc...

Test 31

Verdict:

input
9641697369926504411
425970950212942028697061039529...

correct output
410708299033321711216812810174...

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 1, in <module>
    from sc...

Test 32

Verdict:

input
793769623129909085108356241071...

correct output
264404012608186879272715560773...

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 1, in <module>
    from sc...

Test 33

Verdict:

input
8539777831492675800
436

correct output
3723343134530806648800

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 1, in <module>
    from sc...

Test 34

Verdict:

input
946492187160898604892390431179...

correct output
585982368537725512535970251461...

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 1, in <module>
    from sc...

Test 35

Verdict:

input
874046401974324184707688863838...

correct output
174556202198322810668657866310...

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 1, in <module>
    from sc...

Test 36

Verdict:

input
168584663428092347854539803060...

correct output
235958453587245776929148968707...

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 1, in <module>
    from sc...

Test 37

Verdict:

input
279013912031336395843652482056...

correct output
856375236460411618343887929304...

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 1, in <module>
    from sc...

Test 38

Verdict:

input
909594443312661242668561455177...

correct output
801297086685128929836268694647...

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 1, in <module>
    from sc...

Test 39

Verdict:

input
521558480102200460144622364590...

correct output
403176935665359352292583479223...

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 1, in <module>
    from sc...

Test 40

Verdict:

input
198766521920629467015839613580...

correct output
197951285207558548760833360414...

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 1, in <module>
    from sc...

Test 41

Verdict:

input
388239940637354291806784217812...

correct output
354893636094929851749498258576...

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 1, in <module>
    from sc...

Test 42

Verdict:

input
580031950564534684773525167998...

correct output
225288306472433597677862095876...

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 1, in <module>
    from sc...

Test 43

Verdict:

input
673497493525004204568833306269...

correct output
104167516519697053781119530996...

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 1, in <module>
    from sc...

Test 44

Verdict:

input
583582406474458495157747860432...

correct output
355985267949419682046226194863...

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 1, in <module>
    from sc...

Test 45

Verdict:

input
154401310284121033413839709675...

correct output
472687322036571910421947159369...

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 1, in <module>
    from sc...

Test 46

Verdict:

input
964784520177212016698
135881607827957154173561484162...

correct output
131096471809203739325264543904...

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 1, in <module>
    from sc...

Test 47

Verdict:

input
506417941420848908877158785176...

correct output
124940484872553056181800567857...

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 1, in <module>
    from sc...

Test 48

Verdict:

input
278205703909200971326699489015...

correct output
213362541886605761113025837459...

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 1, in <module>
    from sc...

Test 49

Verdict:

input
488919747667763730629078434642...

correct output
244261035002054726047225565934...

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 1, in <module>
    from sc...

Test 50

Verdict:

input
683013292533355268532590162229...

correct output
271255985219635665074840248062...

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 1, in <module>
    from sc...

Test 51

Verdict:

input
701382950383712289025758984281...

correct output
396240397875971182850884660551...

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 1, in <module>
    from sc...

Test 52

Verdict:

input
950530137216618089651057517232...

correct output
525100658977646195130452101103...

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 1, in <module>
    from sc...

Test 53

Verdict:

input
758180874616256083097058082046...

correct output
612777382638418549100062437996...

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 1, in <module>
    from sc...

Test 54

Verdict:

input
282198270649528096385750216226...

correct output
878945962031578099916769892430...

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 1, in <module>
    from sc...

Test 55

Verdict:

input
374271236006180996628555027124...

correct output
205927043926518428842129271440...

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 1, in <module>
    from sc...

Test 56

Verdict:

input
789860669365068182777748873091...

correct output
369460448033120451265094062370...

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 1, in <module>
    from sc...

Test 57

Verdict:

input
826700926013863385104801713448...

correct output
291751287859134397942962144651...

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 1, in <module>
    from sc...

Test 58

Verdict:

input
947468718382260248801518078140...

correct output
226868697296935607336651841496...

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 1, in <module>
    from sc...

Test 59

Verdict:

input
177252461103268440789803954968...

correct output
111876380249200192763403085310...

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 1, in <module>
    from sc...

Test 60

Verdict:

input
393293577943612353036749957226...

correct output
336630505716557163667422969707...

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 1, in <module>
    from sc...

Test 61

Verdict:

input
320114112664152374910455416563...

correct output
136407754249269979820422504376...

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 1, in <module>
    from sc...

Test 62

Verdict:

input
152757081122748761316522074282...

correct output
107712372482584798763194835348...

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 1, in <module>
    from sc...

Test 63

Verdict:

input
889748332988826746683887083103...

correct output
729454517423131565738173030712...

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 1, in <module>
    from sc...

Test 64

Verdict:

input
311337350148998951898280698942...

correct output
245742878826375358332482490843...

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 1, in <module>
    from sc...

Test 65

Verdict:

input
709744353788876782171034561202...

correct output
198288295923437797210097622398...

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 1, in <module>
    from sc...