2743 | 2023-01-20 15:32:44 | kristof | Szemetessor | python3 | Accepted 100/100 | 699ms | 63788 KiB |
N, M = input().split()
N = int(N)
M = int(M)
avo = 0
lista = [0 for i in range(N)]
MaxErtekLista = list(map(int, input().split()))
for i in range(M):
index, value = input().split()
index = int(index)
value = int(value)
if lista[index] + value > MaxErtekLista[index]:
avo += MaxErtekLista[index] - lista[index]
lista[index] = value
else:
lista[index] += value
for i in range(N):
if lista[i] % MaxErtekLista[i] == 0:
pass
else:
avo += MaxErtekLista[i] - lista[i] % MaxErtekLista[i]
print(avo)
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Accepted | 18ms | 11312 KiB | ||||
2 | Accepted | 17ms | 11588 KiB | ||||
subtask2 | 17/17 | ||||||
3 | Accepted | 17ms | 11428 KiB | ||||
4 | Accepted | 17ms | 12000 KiB | ||||
5 | Accepted | 17ms | 12008 KiB | ||||
6 | Accepted | 17ms | 12152 KiB | ||||
7 | Accepted | 17ms | 12556 KiB | ||||
8 | Accepted | 17ms | 12600 KiB | ||||
9 | Accepted | 17ms | 12600 KiB | ||||
10 | Accepted | 17ms | 12696 KiB | ||||
11 | Accepted | 17ms | 13168 KiB | ||||
subtask3 | 25/25 | ||||||
12 | Accepted | 412ms | 12940 KiB | ||||
13 | Accepted | 446ms | 13380 KiB | ||||
14 | Accepted | 439ms | 13532 KiB | ||||
15 | Accepted | 435ms | 14084 KiB | ||||
16 | Accepted | 435ms | 16052 KiB | ||||
17 | Accepted | 560ms | 37448 KiB | ||||
18 | Accepted | 657ms | 61272 KiB | ||||
19 | Accepted | 653ms | 61352 KiB | ||||
20 | Accepted | 699ms | 61556 KiB | ||||
subtask4 | 20/20 | ||||||
21 | Accepted | 414ms | 16100 KiB | ||||
22 | Accepted | 467ms | 26372 KiB | ||||
23 | Accepted | 432ms | 16432 KiB | ||||
24 | Accepted | 439ms | 19816 KiB | ||||
25 | Accepted | 421ms | 16384 KiB | ||||
26 | Accepted | 504ms | 37540 KiB | ||||
27 | Accepted | 614ms | 59236 KiB | ||||
28 | Accepted | 639ms | 60380 KiB | ||||
29 | Accepted | 637ms | 60560 KiB | ||||
30 | Accepted | 595ms | 63788 KiB | ||||
subtask5 | 38/38 | ||||||
31 | Accepted | 17ms | 13996 KiB | ||||
32 | Accepted | 16ms | 14080 KiB | ||||
33 | Accepted | 17ms | 13820 KiB | ||||
34 | Accepted | 18ms | 13740 KiB | ||||
35 | Accepted | 45ms | 16456 KiB | ||||
36 | Accepted | 432ms | 13944 KiB | ||||
37 | Accepted | 593ms | 61704 KiB | ||||
38 | Accepted | 592ms | 61856 KiB | ||||
39 | Accepted | 588ms | 61968 KiB | ||||
40 | Accepted | 629ms | 61952 KiB | ||||
41 | Accepted | 612ms | 61992 KiB | ||||
42 | Accepted | 637ms | 62088 KiB |