Submission #25865

# Submission time Handle Problem Language Result Execution time Memory
25865 2017-06-24T15:45:49 Z gs14004 Brunhilda’s Birthday (BOI13_brunhilda) C++14
40 / 100
1000 ms 2408 KB
#include <bits/stdc++.h>
using namespace std;
typedef long long lint;
typedef pair<int, int> pi;
const int mod = 1e9 + 7;

int n, q, a[100005];

int main(){
	scanf("%d %d",&n,&q);
	for(int i=1; i<=n; i++) scanf("%d",&a[i]);
	while(q--){
		int x;
		scanf("%d",&x);
		int cnt = 0;
		while(x > 0){
			int maxv = 0;
			for(int j=1; j<=n; j++) maxv = max(maxv, x % a[j]);
			if(maxv == 0){
				puts("oo");
				cnt = -1;
				break;
			}
			else x -= maxv;
			cnt++;
		}
		if(cnt >= 0) printf("%d\n", cnt);
	}
}

Compilation message

brunhilda.cpp: In function 'int main()':
brunhilda.cpp:10:22: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d %d",&n,&q);
                      ^
brunhilda.cpp:11:43: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  for(int i=1; i<=n; i++) scanf("%d",&a[i]);
                                           ^
brunhilda.cpp:14:17: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d",&x);
                 ^
# Verdict Execution time Memory Grader output
1 Correct 3 ms 2408 KB Output is correct
2 Correct 0 ms 2408 KB Output is correct
3 Correct 0 ms 2408 KB Output is correct
4 Correct 6 ms 2408 KB Output is correct
5 Correct 0 ms 2408 KB Output is correct
6 Correct 3 ms 2408 KB Output is correct
7 Correct 0 ms 2408 KB Output is correct
8 Correct 0 ms 2408 KB Output is correct
9 Correct 0 ms 2408 KB Output is correct
10 Correct 3 ms 2408 KB Output is correct
11 Correct 6 ms 2408 KB Output is correct
12 Correct 0 ms 2408 KB Output is correct
13 Correct 6 ms 2408 KB Output is correct
14 Correct 43 ms 2408 KB Output is correct
15 Correct 0 ms 2408 KB Output is correct
16 Correct 0 ms 2408 KB Output is correct
17 Correct 19 ms 2408 KB Output is correct
18 Correct 3 ms 2408 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 2408 KB Output is correct
2 Correct 13 ms 2408 KB Output is correct
3 Correct 9 ms 2408 KB Output is correct
4 Correct 0 ms 2408 KB Output is correct
5 Correct 3 ms 2408 KB Output is correct
6 Correct 0 ms 2408 KB Output is correct
7 Correct 3 ms 2408 KB Output is correct
8 Correct 0 ms 2408 KB Output is correct
9 Correct 16 ms 2408 KB Output is correct
10 Correct 9 ms 2408 KB Output is correct
11 Correct 6 ms 2408 KB Output is correct
12 Correct 3 ms 2408 KB Output is correct
13 Correct 0 ms 2408 KB Output is correct
14 Correct 0 ms 2408 KB Output is correct
15 Correct 3 ms 2408 KB Output is correct
16 Correct 16 ms 2408 KB Output is correct
17 Correct 3 ms 2408 KB Output is correct
18 Correct 16 ms 2408 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 1000 ms 2408 KB Execution timed out
2 Execution timed out 1000 ms 2408 KB Execution timed out
3 Execution timed out 1000 ms 2408 KB Execution timed out
4 Execution timed out 1000 ms 2408 KB Execution timed out
5 Execution timed out 1000 ms 2408 KB Execution timed out
6 Execution timed out 1000 ms 2408 KB Execution timed out
7 Execution timed out 1000 ms 2408 KB Execution timed out
8 Execution timed out 1000 ms 2408 KB Execution timed out
9 Execution timed out 1000 ms 2408 KB Execution timed out
10 Execution timed out 1000 ms 2408 KB Execution timed out
11 Execution timed out 1000 ms 2408 KB Execution timed out
12 Execution timed out 1000 ms 2408 KB Execution timed out
13 Execution timed out 1000 ms 2408 KB Execution timed out
14 Execution timed out 1000 ms 2408 KB Execution timed out
15 Execution timed out 1000 ms 2408 KB Execution timed out
16 Execution timed out 1000 ms 2408 KB Execution timed out
17 Execution timed out 1000 ms 2408 KB Execution timed out
18 Execution timed out 1000 ms 2408 KB Execution timed out
19 Execution timed out 1000 ms 2408 KB Execution timed out
20 Execution timed out 1000 ms 2408 KB Execution timed out
21 Execution timed out 1000 ms 2408 KB Execution timed out
22 Execution timed out 1000 ms 2408 KB Execution timed out
23 Execution timed out 1000 ms 2408 KB Execution timed out
24 Execution timed out 1000 ms 2408 KB Execution timed out
25 Execution timed out 1000 ms 2408 KB Execution timed out
26 Execution timed out 1000 ms 2408 KB Execution timed out
27 Execution timed out 1000 ms 2408 KB Execution timed out
28 Execution timed out 1000 ms 2408 KB Execution timed out
29 Execution timed out 1000 ms 2408 KB Execution timed out
30 Execution timed out 1000 ms 2408 KB Execution timed out
31 Execution timed out 1000 ms 2408 KB Execution timed out
32 Execution timed out 1000 ms 2408 KB Execution timed out
33 Execution timed out 1000 ms 2408 KB Execution timed out
34 Execution timed out 1000 ms 2408 KB Execution timed out
35 Execution timed out 1000 ms 2408 KB Execution timed out
36 Execution timed out 1000 ms 2408 KB Execution timed out
37 Execution timed out 1000 ms 2408 KB Execution timed out
38 Execution timed out 1000 ms 2408 KB Execution timed out
39 Execution timed out 1000 ms 2408 KB Execution timed out
40 Execution timed out 1000 ms 2408 KB Execution timed out
41 Execution timed out 1000 ms 2408 KB Execution timed out
42 Execution timed out 1000 ms 2408 KB Execution timed out