Submission #31876

# Submission time Handle Problem Language Result Execution time Memory
31876 2017-09-11T08:28:00 Z YoLo Brunhilda’s Birthday (BOI13_brunhilda) C++14
62.8571 / 100
623 ms 158656 KB
#include<bits/stdc++.h>
using namespace std;
int n, m, a[100009], j, num[20000009], nex, cur, t = 1, ans[20000009];
signed main()
{
	scanf("%d %d",&n,&m);
	for(int i = 1; i <= n; i++)
		scanf("%d",&a[i]);
	for(int i = 1; i <= n; i++)
		for(int j = 0; j <= 10000000; j += a[i])
			num[j] = max(num[j], a[i]);
	for(int i = 1; i <= 10000000; i++)
	{
		while(i >= num[cur] + cur && cur < i)
			cur ++;
		if(cur == i)
			break;
		ans[i] = ans[cur] + 1;
	}
	while(m --)
	{
		int k;
		cin >> k;
		if(ans[k] > 0)
			printf("%d\n",ans[k]);
		else
			printf("oo\n");
	}
}

Compilation message

brunhilda.cpp: In function 'int main()':
brunhilda.cpp:6:22: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d %d",&n,&m);
                      ^
brunhilda.cpp:8:20: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d",&a[i]);
                    ^
# Verdict Execution time Memory Grader output
1 Correct 29 ms 158656 KB Output is correct
2 Correct 99 ms 158656 KB Output is correct
3 Correct 43 ms 158656 KB Output is correct
4 Correct 136 ms 158656 KB Output is correct
5 Correct 113 ms 158656 KB Output is correct
6 Correct 26 ms 158656 KB Output is correct
7 Correct 36 ms 158656 KB Output is correct
8 Correct 49 ms 158656 KB Output is correct
9 Correct 116 ms 158656 KB Output is correct
10 Correct 169 ms 158656 KB Output is correct
11 Correct 149 ms 158656 KB Output is correct
12 Correct 53 ms 158656 KB Output is correct
13 Correct 336 ms 158656 KB Output is correct
14 Correct 376 ms 158656 KB Output is correct
15 Correct 113 ms 158656 KB Output is correct
16 Correct 103 ms 158656 KB Output is correct
17 Correct 116 ms 158656 KB Output is correct
18 Correct 76 ms 158656 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 79 ms 158656 KB Output is correct
2 Correct 69 ms 158656 KB Output is correct
3 Correct 343 ms 158656 KB Output is correct
4 Correct 143 ms 158656 KB Output is correct
5 Correct 233 ms 158656 KB Output is correct
6 Correct 79 ms 158656 KB Output is correct
7 Correct 79 ms 158656 KB Output is correct
8 Correct 136 ms 158656 KB Output is correct
9 Correct 263 ms 158656 KB Output is correct
10 Correct 323 ms 158656 KB Output is correct
11 Correct 316 ms 158656 KB Output is correct
12 Correct 159 ms 158656 KB Output is correct
13 Correct 53 ms 158656 KB Output is correct
14 Correct 116 ms 158656 KB Output is correct
15 Correct 246 ms 158656 KB Output is correct
16 Correct 73 ms 158656 KB Output is correct
17 Correct 246 ms 158656 KB Output is correct
18 Correct 246 ms 158656 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 383 ms 158656 KB Output is correct
2 Correct 409 ms 158656 KB Output is correct
3 Correct 499 ms 158656 KB Output is correct
4 Runtime error 373 ms 158656 KB Execution timed out (wall clock limit exceeded)
5 Runtime error 289 ms 158656 KB Execution timed out (wall clock limit exceeded)
6 Runtime error 539 ms 158656 KB Execution timed out (wall clock limit exceeded)
7 Correct 289 ms 158656 KB Output is correct
8 Runtime error 466 ms 158656 KB Execution timed out (wall clock limit exceeded)
9 Correct 329 ms 158656 KB Output is correct
10 Correct 236 ms 158656 KB Output is correct
11 Correct 263 ms 158656 KB Output is correct
12 Correct 419 ms 158656 KB Output is correct
13 Runtime error 563 ms 158656 KB Execution timed out (wall clock limit exceeded)
14 Runtime error 353 ms 158656 KB Execution timed out (wall clock limit exceeded)
15 Correct 443 ms 158656 KB Output is correct
16 Correct 373 ms 158656 KB Output is correct
17 Correct 333 ms 158656 KB Output is correct
18 Correct 519 ms 158656 KB Output is correct
19 Correct 116 ms 158656 KB Output is correct
20 Runtime error 569 ms 158656 KB Execution timed out (wall clock limit exceeded)
21 Runtime error 376 ms 158656 KB Execution timed out (wall clock limit exceeded)
22 Runtime error 556 ms 158656 KB Execution timed out (wall clock limit exceeded)
23 Runtime error 329 ms 158656 KB Execution timed out (wall clock limit exceeded)
24 Runtime error 279 ms 158656 KB Execution timed out (wall clock limit exceeded)
25 Runtime error 453 ms 158656 KB Execution timed out (wall clock limit exceeded)
26 Runtime error 346 ms 158656 KB Execution timed out (wall clock limit exceeded)
27 Correct 623 ms 158656 KB Output is correct
28 Runtime error 233 ms 158656 KB Execution timed out (wall clock limit exceeded)
29 Correct 499 ms 158656 KB Output is correct
30 Runtime error 539 ms 158656 KB Execution timed out (wall clock limit exceeded)
31 Correct 303 ms 158656 KB Output is correct
32 Runtime error 299 ms 158656 KB Execution timed out (wall clock limit exceeded)
33 Runtime error 216 ms 158656 KB Execution timed out (wall clock limit exceeded)
34 Runtime error 386 ms 158656 KB Execution timed out (wall clock limit exceeded)
35 Runtime error 366 ms 158656 KB Execution timed out (wall clock limit exceeded)
36 Runtime error 516 ms 158656 KB Execution timed out (wall clock limit exceeded)
37 Runtime error 233 ms 158656 KB Execution timed out (wall clock limit exceeded)
38 Runtime error 526 ms 158656 KB Execution timed out (wall clock limit exceeded)
39 Runtime error 256 ms 158656 KB Execution timed out (wall clock limit exceeded)
40 Runtime error 459 ms 158656 KB Execution timed out (wall clock limit exceeded)
41 Runtime error 319 ms 158656 KB Execution timed out (wall clock limit exceeded)
42 Runtime error 416 ms 158656 KB Execution timed out (wall clock limit exceeded)