Submission #1074362


Source Code Expand

import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int N = Integer.parseInt(sc.next());

		int A[] = new int[N];
		int B[] = new int[N];

		for(int i = 0; i < N; i++){
			A[i] = Integer.parseInt(sc.next());
			B[i] = Integer.parseInt(sc.next());
		}

		int res = 0;

		for(int i = N-1; i >= 0; i--){
			while(A[i] % B[i] != 0){
				for(int j = i; j >= 0; j--){
					A[j]++;
				}
				res++;
			}
		}

		System.out.println(res);

	}

}

Submission Info

Submission Time
Task A - Multiple Array
User pocket
Language Java8 (OpenJDK 1.8.0)
Score 0
Code Size 549 Byte
Status TLE
Exec Time 2105 ms
Memory 47260 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 300
Status
AC × 2
AC × 9
TLE × 9
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 2105 ms 32764 KB
02.txt TLE 2105 ms 33340 KB
03.txt TLE 2105 ms 33472 KB
04.txt TLE 2105 ms 33052 KB
05.txt TLE 2105 ms 32772 KB
06.txt TLE 2105 ms 32552 KB
07.txt AC 499 ms 32964 KB
08.txt TLE 2105 ms 33264 KB
09.txt AC 515 ms 47260 KB
10.txt TLE 2105 ms 32928 KB
11.txt AC 491 ms 32096 KB
12.txt AC 472 ms 33912 KB
13.txt TLE 2105 ms 32072 KB
14.txt AC 528 ms 33384 KB
15.txt AC 123 ms 9556 KB
16.txt AC 126 ms 9552 KB
s1.txt AC 124 ms 9552 KB
s2.txt AC 124 ms 9680 KB