Submission #1124964


Source Code Expand

N = int(input())
total = 0
A = [None] * N
B = [None] * N
for i in range(N):
    A[i], B[i] = map(int, input().split())
	
for i in range(N-1,-1,-1):
	a = A[i] % B[i]
	if a == 0:
		pass
	else:
		total = total + B[i] - a
		for j in range (i):
			A[i] = A[i] + B[i] - a


print (total)
	

Submission Info

Submission Time
Task A - Multiple Array
User himagegine
Language Python (3.4.3)
Score 0
Code Size 305 Byte
Status WA
Exec Time 2104 ms
Memory 10996 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 300
Status
WA × 2
AC × 6
WA × 2
TLE × 10
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 TLE 2104 ms 10868 KB
02.txt TLE 2104 ms 10868 KB
03.txt TLE 2104 ms 10868 KB
04.txt TLE 2104 ms 10868 KB
05.txt TLE 2104 ms 10868 KB
06.txt TLE 2104 ms 10868 KB
07.txt AC 304 ms 7748 KB
08.txt TLE 2104 ms 10868 KB
09.txt AC 291 ms 7668 KB
10.txt TLE 2104 ms 10868 KB
11.txt TLE 2104 ms 10868 KB
12.txt AC 294 ms 4596 KB
13.txt TLE 2104 ms 10868 KB
14.txt AC 320 ms 10996 KB
15.txt AC 17 ms 3060 KB
16.txt AC 17 ms 3060 KB
s1.txt WA 17 ms 3064 KB
s2.txt WA 17 ms 3060 KB