답안 #31875

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
31875 2017-09-11T08:24:06 Z YoLo Brunhilda’s Birthday (BOI13_brunhilda) C++14
57.1429 / 100
616 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++)
	{
		j = 0;
		while(j <= 10000000)
		{
			num[j] = max(num[j], a[i]);
			j += a[i];
		}
	}
	num[1] = num[0];
	ans[1] = 1;
	for(int i = 2; 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]);
                    ^
# 결과 실행 시간 메모리 Grader output
1 Correct 16 ms 158656 KB Output is correct
2 Correct 79 ms 158656 KB Output is correct
3 Correct 46 ms 158656 KB Output is correct
4 Correct 66 ms 158656 KB Output is correct
5 Correct 76 ms 158656 KB Output is correct
6 Correct 29 ms 158656 KB Output is correct
7 Correct 43 ms 158656 KB Output is correct
8 Correct 43 ms 158656 KB Output is correct
9 Correct 109 ms 158656 KB Output is correct
10 Correct 139 ms 158656 KB Output is correct
11 Correct 129 ms 158656 KB Output is correct
12 Correct 63 ms 158656 KB Output is correct
13 Correct 276 ms 158656 KB Output is correct
14 Correct 323 ms 158656 KB Output is correct
15 Correct 113 ms 158656 KB Output is correct
16 Correct 119 ms 158656 KB Output is correct
17 Correct 149 ms 158656 KB Output is correct
18 Correct 113 ms 158656 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 89 ms 158656 KB Output is correct
2 Correct 96 ms 158656 KB Output is correct
3 Correct 383 ms 158656 KB Output is correct
4 Correct 93 ms 158656 KB Output is correct
5 Correct 219 ms 158656 KB Output is correct
6 Correct 99 ms 158656 KB Output is correct
7 Correct 99 ms 158656 KB Output is correct
8 Correct 99 ms 158656 KB Output is correct
9 Correct 286 ms 158656 KB Output is correct
10 Correct 403 ms 158656 KB Output is correct
11 Correct 386 ms 158656 KB Output is correct
12 Correct 166 ms 158656 KB Output is correct
13 Correct 49 ms 158656 KB Output is correct
14 Correct 119 ms 158656 KB Output is correct
15 Correct 243 ms 158656 KB Output is correct
16 Correct 73 ms 158656 KB Output is correct
17 Correct 273 ms 158656 KB Output is correct
18 Correct 266 ms 158656 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 316 ms 158656 KB Output is correct
2 Correct 516 ms 158656 KB Output is correct
3 Runtime error 553 ms 158656 KB Execution timed out (wall clock limit exceeded)
4 Runtime error 346 ms 158656 KB Execution timed out (wall clock limit exceeded)
5 Runtime error 243 ms 158656 KB Execution timed out (wall clock limit exceeded)
6 Runtime error 456 ms 158656 KB Execution timed out (wall clock limit exceeded)
7 Runtime error 356 ms 158656 KB Execution timed out (wall clock limit exceeded)
8 Runtime error 569 ms 158656 KB Execution timed out (wall clock limit exceeded)
9 Runtime error 523 ms 158656 KB Execution timed out (wall clock limit exceeded)
10 Correct 219 ms 158656 KB Output is correct
11 Correct 309 ms 158656 KB Output is correct
12 Correct 359 ms 158656 KB Output is correct
13 Runtime error 549 ms 158656 KB Execution timed out (wall clock limit exceeded)
14 Runtime error 323 ms 158656 KB Execution timed out (wall clock limit exceeded)
15 Correct 483 ms 158656 KB Output is correct
16 Correct 449 ms 158656 KB Output is correct
17 Correct 316 ms 158656 KB Output is correct
18 Correct 479 ms 158656 KB Output is correct
19 Correct 233 ms 158656 KB Output is correct
20 Correct 519 ms 158656 KB Output is correct
21 Runtime error 379 ms 158656 KB Execution timed out (wall clock limit exceeded)
22 Runtime error 609 ms 158656 KB Execution timed out (wall clock limit exceeded)
23 Runtime error 266 ms 158656 KB Execution timed out (wall clock limit exceeded)
24 Runtime error 289 ms 158656 KB Execution timed out (wall clock limit exceeded)
25 Runtime error 466 ms 158656 KB Execution timed out (wall clock limit exceeded)
26 Runtime error 396 ms 158656 KB Execution timed out (wall clock limit exceeded)
27 Runtime error 616 ms 158656 KB Execution timed out (wall clock limit exceeded)
28 Runtime error 293 ms 158656 KB Execution timed out (wall clock limit exceeded)
29 Runtime error 586 ms 158656 KB Execution timed out (wall clock limit exceeded)
30 Runtime error 526 ms 158656 KB Execution timed out (wall clock limit exceeded)
31 Runtime error 303 ms 158656 KB Execution timed out (wall clock limit exceeded)
32 Runtime error 279 ms 158656 KB Execution timed out (wall clock limit exceeded)
33 Runtime error 239 ms 158656 KB Execution timed out (wall clock limit exceeded)
34 Runtime error 453 ms 158656 KB Execution timed out (wall clock limit exceeded)
35 Runtime error 289 ms 158656 KB Execution timed out (wall clock limit exceeded)
36 Runtime error 556 ms 158656 KB Execution timed out (wall clock limit exceeded)
37 Runtime error 286 ms 158656 KB Execution timed out (wall clock limit exceeded)
38 Runtime error 473 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 436 ms 158656 KB Execution timed out (wall clock limit exceeded)
41 Correct 376 ms 158656 KB Output is correct
42 Runtime error 513 ms 158656 KB Execution timed out (wall clock limit exceeded)