Submission #98039

# Submission time Handle Problem Language Result Execution time Memory
98039 2019-02-20T02:17:48 Z Sharon Brunhilda’s Birthday (BOI13_brunhilda) Java 11
0 / 100
306 ms 15468 KB
import java.util.*;

public class brunhilda {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int t = scan.nextInt();
		int[] p = new int[n];
		long prod = 1;
		for(int i = 0; i < n; i++){
			p[i] = scan.nextInt();
			if(Long.MAX_VALUE/p[i] > prod)
				prod *= p[i];
			else break;
		}
		for(int q = 1; q <= t; q++){
			int m = scan.nextInt();
			if(m >= prod){
				System.out.println("oo");
				continue;
			}
			int ans = 0;
			while(m > 0){
				ans++;
				for(int i = n-1; i >= 0; i--){
					if(m%p[i] != 0){
						m -= m%p[i];
						break;
					}
				}
			}
			System.out.println(ans);
		}
	}
}
# Verdict Execution time Memory Grader output
1 Incorrect 306 ms 15468 KB Output isn't correct
2 Runtime error 151 ms 11160 KB Execution failed because the return code was nonzero
3 Incorrect 166 ms 11080 KB Output isn't correct
4 Runtime error 143 ms 10956 KB Execution failed because the return code was nonzero
5 Incorrect 154 ms 10816 KB Output isn't correct
6 Incorrect 284 ms 15040 KB Output isn't correct
7 Incorrect 128 ms 10920 KB Output isn't correct
8 Incorrect 144 ms 11324 KB Output isn't correct
9 Incorrect 156 ms 11140 KB Output isn't correct
10 Runtime error 130 ms 10852 KB Execution failed because the return code was nonzero
11 Runtime error 140 ms 11040 KB Execution failed because the return code was nonzero
12 Runtime error 131 ms 10920 KB Execution failed because the return code was nonzero
13 Runtime error 136 ms 11144 KB Execution failed because the return code was nonzero
14 Runtime error 135 ms 11064 KB Execution failed because the return code was nonzero
15 Runtime error 130 ms 11076 KB Execution failed because the return code was nonzero
16 Runtime error 131 ms 10984 KB Execution failed because the return code was nonzero
17 Runtime error 128 ms 10984 KB Execution failed because the return code was nonzero
18 Runtime error 94 ms 10944 KB Execution failed because the return code was nonzero
# Verdict Execution time Memory Grader output
1 Runtime error 145 ms 11148 KB Execution failed because the return code was nonzero
2 Runtime error 143 ms 11340 KB Execution failed because the return code was nonzero
3 Runtime error 163 ms 11492 KB Execution failed because the return code was nonzero
4 Runtime error 148 ms 11040 KB Execution failed because the return code was nonzero
5 Runtime error 152 ms 11328 KB Execution failed because the return code was nonzero
6 Runtime error 164 ms 11080 KB Execution failed because the return code was nonzero
7 Runtime error 146 ms 11048 KB Execution failed because the return code was nonzero
8 Runtime error 120 ms 10924 KB Execution failed because the return code was nonzero
9 Runtime error 120 ms 11204 KB Execution failed because the return code was nonzero
10 Runtime error 134 ms 11300 KB Execution failed because the return code was nonzero
11 Runtime error 131 ms 11232 KB Execution failed because the return code was nonzero
12 Runtime error 151 ms 11260 KB Execution failed because the return code was nonzero
13 Runtime error 149 ms 11060 KB Execution failed because the return code was nonzero
14 Runtime error 150 ms 11300 KB Execution failed because the return code was nonzero
15 Runtime error 161 ms 11348 KB Execution failed because the return code was nonzero
16 Runtime error 138 ms 11592 KB Execution failed because the return code was nonzero
17 Runtime error 131 ms 11180 KB Execution failed because the return code was nonzero
18 Runtime error 130 ms 11556 KB Execution failed because the return code was nonzero
# Verdict Execution time Memory Grader output
1 Runtime error 129 ms 11084 KB Execution failed because the return code was nonzero
2 Runtime error 145 ms 11236 KB Execution failed because the return code was nonzero
3 Runtime error 134 ms 11132 KB Execution failed because the return code was nonzero
4 Runtime error 152 ms 11064 KB Execution failed because the return code was nonzero
5 Runtime error 141 ms 11404 KB Execution failed because the return code was nonzero
6 Runtime error 134 ms 10984 KB Execution failed because the return code was nonzero
7 Runtime error 132 ms 11468 KB Execution failed because the return code was nonzero
8 Runtime error 142 ms 11156 KB Execution failed because the return code was nonzero
9 Runtime error 134 ms 11324 KB Execution failed because the return code was nonzero
10 Runtime error 152 ms 10956 KB Execution failed because the return code was nonzero
11 Runtime error 143 ms 10968 KB Execution failed because the return code was nonzero
12 Runtime error 157 ms 11092 KB Execution failed because the return code was nonzero
13 Runtime error 136 ms 10836 KB Execution failed because the return code was nonzero
14 Runtime error 148 ms 11084 KB Execution failed because the return code was nonzero
15 Runtime error 158 ms 11216 KB Execution failed because the return code was nonzero
16 Runtime error 130 ms 11124 KB Execution failed because the return code was nonzero
17 Runtime error 143 ms 11236 KB Execution failed because the return code was nonzero
18 Runtime error 144 ms 11260 KB Execution failed because the return code was nonzero
19 Runtime error 136 ms 11000 KB Execution failed because the return code was nonzero
20 Runtime error 136 ms 11188 KB Execution failed because the return code was nonzero
21 Runtime error 145 ms 11156 KB Execution failed because the return code was nonzero
22 Runtime error 149 ms 11556 KB Execution failed because the return code was nonzero
23 Runtime error 139 ms 11096 KB Execution failed because the return code was nonzero
24 Runtime error 147 ms 11108 KB Execution failed because the return code was nonzero
25 Runtime error 149 ms 11076 KB Execution failed because the return code was nonzero
26 Runtime error 147 ms 11100 KB Execution failed because the return code was nonzero
27 Runtime error 144 ms 11412 KB Execution failed because the return code was nonzero
28 Runtime error 152 ms 11236 KB Execution failed because the return code was nonzero
29 Runtime error 133 ms 11436 KB Execution failed because the return code was nonzero
30 Runtime error 151 ms 11188 KB Execution failed because the return code was nonzero
31 Runtime error 141 ms 11160 KB Execution failed because the return code was nonzero
32 Runtime error 130 ms 11116 KB Execution failed because the return code was nonzero
33 Runtime error 158 ms 11060 KB Execution failed because the return code was nonzero
34 Runtime error 132 ms 11448 KB Execution failed because the return code was nonzero
35 Runtime error 155 ms 11036 KB Execution failed because the return code was nonzero
36 Runtime error 144 ms 11276 KB Execution failed because the return code was nonzero
37 Runtime error 137 ms 11480 KB Execution failed because the return code was nonzero
38 Runtime error 153 ms 10988 KB Execution failed because the return code was nonzero
39 Runtime error 140 ms 11068 KB Execution failed because the return code was nonzero
40 Runtime error 152 ms 10868 KB Execution failed because the return code was nonzero
41 Runtime error 129 ms 11384 KB Execution failed because the return code was nonzero
42 Runtime error 141 ms 10808 KB Execution failed because the return code was nonzero