답안 #31877

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
31877 2017-09-11T08:30:26 Z YoLo Brunhilda’s Birthday (BOI13_brunhilda) C++14
62.8571 / 100
606 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;
	}
	for(int i = 0; i < m; i++)
	{
		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 103 ms 158656 KB Output is correct
3 Correct 36 ms 158656 KB Output is correct
4 Correct 103 ms 158656 KB Output is correct
5 Correct 76 ms 158656 KB Output is correct
6 Correct 16 ms 158656 KB Output is correct
7 Correct 39 ms 158656 KB Output is correct
8 Correct 56 ms 158656 KB Output is correct
9 Correct 139 ms 158656 KB Output is correct
10 Correct 146 ms 158656 KB Output is correct
11 Correct 139 ms 158656 KB Output is correct
12 Correct 49 ms 158656 KB Output is correct
13 Correct 306 ms 158656 KB Output is correct
14 Correct 299 ms 158656 KB Output is correct
15 Correct 89 ms 158656 KB Output is correct
16 Correct 89 ms 158656 KB Output is correct
17 Correct 113 ms 158656 KB Output is correct
18 Correct 116 ms 158656 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 63 ms 158656 KB Output is correct
2 Correct 99 ms 158656 KB Output is correct
3 Correct 336 ms 158656 KB Output is correct
4 Correct 116 ms 158656 KB Output is correct
5 Correct 219 ms 158656 KB Output is correct
6 Correct 89 ms 158656 KB Output is correct
7 Correct 89 ms 158656 KB Output is correct
8 Correct 99 ms 158656 KB Output is correct
9 Correct 263 ms 158656 KB Output is correct
10 Correct 343 ms 158656 KB Output is correct
11 Correct 366 ms 158656 KB Output is correct
12 Correct 169 ms 158656 KB Output is correct
13 Correct 69 ms 158656 KB Output is correct
14 Correct 116 ms 158656 KB Output is correct
15 Correct 256 ms 158656 KB Output is correct
16 Correct 83 ms 158656 KB Output is correct
17 Correct 273 ms 158656 KB Output is correct
18 Correct 316 ms 158656 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Runtime error 536 ms 158656 KB Execution timed out (wall clock limit exceeded)
2 Runtime error 606 ms 158656 KB Execution timed out (wall clock limit exceeded)
3 Correct 456 ms 158656 KB Output is correct
4 Runtime error 413 ms 158656 KB Execution timed out (wall clock limit exceeded)
5 Runtime error 283 ms 158656 KB Execution timed out (wall clock limit exceeded)
6 Runtime error 489 ms 158656 KB Execution timed out (wall clock limit exceeded)
7 Runtime error 489 ms 158656 KB Execution timed out (wall clock limit exceeded)
8 Correct 383 ms 158656 KB Output is correct
9 Correct 463 ms 158656 KB Output is correct
10 Correct 326 ms 158656 KB Output is correct
11 Correct 299 ms 158656 KB Output is correct
12 Correct 409 ms 158656 KB Output is correct
13 Runtime error 593 ms 158656 KB Execution timed out (wall clock limit exceeded)
14 Correct 373 ms 158656 KB Output is correct
15 Correct 409 ms 158656 KB Output is correct
16 Correct 439 ms 158656 KB Output is correct
17 Correct 276 ms 158656 KB Output is correct
18 Correct 526 ms 158656 KB Output is correct
19 Correct 166 ms 158656 KB Output is correct
20 Runtime error 533 ms 158656 KB Execution timed out (wall clock limit exceeded)
21 Runtime error 363 ms 158656 KB Execution timed out (wall clock limit exceeded)
22 Runtime error 606 ms 158656 KB Execution timed out (wall clock limit exceeded)
23 Runtime error 316 ms 158656 KB Execution timed out (wall clock limit exceeded)
24 Runtime error 233 ms 158656 KB Execution timed out (wall clock limit exceeded)
25 Runtime error 396 ms 158656 KB Execution timed out (wall clock limit exceeded)
26 Runtime error 389 ms 158656 KB Execution timed out (wall clock limit exceeded)
27 Correct 519 ms 158656 KB Output is correct
28 Runtime error 253 ms 158656 KB Execution timed out (wall clock limit exceeded)
29 Runtime error 533 ms 158656 KB Execution timed out (wall clock limit exceeded)
30 Runtime error 513 ms 158656 KB Execution timed out (wall clock limit exceeded)
31 Runtime error 256 ms 158656 KB Execution timed out (wall clock limit exceeded)
32 Runtime error 346 ms 158656 KB Execution timed out (wall clock limit exceeded)
33 Runtime error 203 ms 158656 KB Execution timed out (wall clock limit exceeded)
34 Correct 386 ms 158656 KB Output is correct
35 Runtime error 246 ms 158656 KB Execution timed out (wall clock limit exceeded)
36 Runtime error 503 ms 158656 KB Execution timed out (wall clock limit exceeded)
37 Runtime error 276 ms 158656 KB Execution timed out (wall clock limit exceeded)
38 Correct 466 ms 158656 KB Output is correct
39 Correct 286 ms 158656 KB Output is correct
40 Runtime error 449 ms 158656 KB Execution timed out (wall clock limit exceeded)
41 Runtime error 413 ms 158656 KB Execution timed out (wall clock limit exceeded)
42 Runtime error 476 ms 158656 KB Execution timed out (wall clock limit exceeded)