Submission #1607823
Source Code Expand
from collections import defaultdict, Counter from itertools import product, groupby, count, permutations, combinations from math import pi, sqrt from collections import deque from bisect import bisect, bisect_left, bisect_right INF = float("inf") def ceil(a, b): return (a + b - 1) // b def main(): N = int(input()) a_list, b_list = [], [] for _ in range(N): A, B = map(int, input().split()) a_list.append(A) b_list.append(B) now = 0 for a, b in zip(a_list[::-1], b_list[::-1]): a += now d = (b * ceil(a, b)) - a now += d print(now) if __name__ == '__main__': main()
Submission Info
Submission Time | |
---|---|
Task | A - Multiple Array |
User | MitI_7 |
Language | Python (3.4.3) |
Score | 300 |
Code Size | 686 Byte |
Status | AC |
Exec Time | 318 ms |
Memory | 13100 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 300 / 300 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | s1.txt, s2.txt |
All | 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, 11.txt, 12.txt, 13.txt, 14.txt, 15.txt, 16.txt, s1.txt, s2.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
01.txt | AC | 315 ms | 13100 KB |
02.txt | AC | 316 ms | 12984 KB |
03.txt | AC | 308 ms | 12980 KB |
04.txt | AC | 308 ms | 12976 KB |
05.txt | AC | 311 ms | 12976 KB |
06.txt | AC | 318 ms | 12876 KB |
07.txt | AC | 296 ms | 9688 KB |
08.txt | AC | 307 ms | 12980 KB |
09.txt | AC | 296 ms | 9808 KB |
10.txt | AC | 309 ms | 12876 KB |
11.txt | AC | 293 ms | 12916 KB |
12.txt | AC | 281 ms | 6564 KB |
13.txt | AC | 299 ms | 12908 KB |
14.txt | AC | 308 ms | 12892 KB |
15.txt | AC | 20 ms | 3316 KB |
16.txt | AC | 21 ms | 3316 KB |
s1.txt | AC | 20 ms | 3316 KB |
s2.txt | AC | 21 ms | 3316 KB |