답안 #544607

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
544607 2022-04-02T13:32:44 Z rainboy Brunhilda’s Birthday (BOI13_brunhilda) C
100 / 100
241 ms 80252 KB
#include <stdio.h>
#include <string.h>

#define N	10000000
#define INF	0x3f3f3f3f

int main() {
	static int rr[N + 1], dp[N + 1];
	int m, q, h, i, j;

	scanf("%d%d", &m, &q);
	for (h = 0; h < m; h++) {
		int p;

		scanf("%d", &p);
		for (i = 0; i <= N; i += p)
			rr[i] = i + p;
	}
	memset(dp, 0x3f, (N + 1) * sizeof *dp), dp[0] = 0;
	for (i = 0, j = 1; i <= N && dp[i] != INF; i++)
		while (j <= N && j < rr[i])
			dp[j++] = dp[i] + 1;
	while (q--) {
		int n;

		scanf("%d", &n);
		if (dp[n] == INF)
			printf("oo\n");
		else
			printf("%d\n", dp[n]);
	}
	return 0;
}

Compilation message

brunhilda.c: In function 'main':
brunhilda.c:11:2: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |  scanf("%d%d", &m, &q);
      |  ^~~~~~~~~~~~~~~~~~~~~
brunhilda.c:15:3: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   15 |   scanf("%d", &p);
      |   ^~~~~~~~~~~~~~~
brunhilda.c:26:3: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   26 |   scanf("%d", &n);
      |   ^~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 37 ms 78508 KB Output is correct
2 Correct 73 ms 78540 KB Output is correct
3 Correct 50 ms 78452 KB Output is correct
4 Correct 57 ms 78512 KB Output is correct
5 Correct 77 ms 78532 KB Output is correct
6 Correct 35 ms 78540 KB Output is correct
7 Correct 43 ms 78536 KB Output is correct
8 Correct 56 ms 78520 KB Output is correct
9 Correct 84 ms 78540 KB Output is correct
10 Correct 109 ms 78472 KB Output is correct
11 Correct 92 ms 78464 KB Output is correct
12 Correct 51 ms 78540 KB Output is correct
13 Correct 148 ms 78556 KB Output is correct
14 Correct 150 ms 78604 KB Output is correct
15 Correct 77 ms 78548 KB Output is correct
16 Correct 71 ms 78440 KB Output is correct
17 Correct 69 ms 78508 KB Output is correct
18 Correct 71 ms 78584 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 60 ms 78624 KB Output is correct
2 Correct 74 ms 79148 KB Output is correct
3 Correct 180 ms 79004 KB Output is correct
4 Correct 79 ms 78472 KB Output is correct
5 Correct 130 ms 78960 KB Output is correct
6 Correct 64 ms 78540 KB Output is correct
7 Correct 60 ms 78628 KB Output is correct
8 Correct 73 ms 78664 KB Output is correct
9 Correct 149 ms 79008 KB Output is correct
10 Correct 186 ms 79012 KB Output is correct
11 Correct 171 ms 78712 KB Output is correct
12 Correct 106 ms 78540 KB Output is correct
13 Correct 58 ms 78488 KB Output is correct
14 Correct 76 ms 78552 KB Output is correct
15 Correct 142 ms 78752 KB Output is correct
16 Correct 75 ms 79208 KB Output is correct
17 Correct 171 ms 78460 KB Output is correct
18 Correct 178 ms 79268 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 156 ms 79276 KB Output is correct
2 Correct 191 ms 79036 KB Output is correct
3 Correct 241 ms 79392 KB Output is correct
4 Correct 132 ms 79396 KB Output is correct
5 Correct 100 ms 80188 KB Output is correct
6 Correct 173 ms 79520 KB Output is correct
7 Correct 161 ms 79780 KB Output is correct
8 Correct 157 ms 79292 KB Output is correct
9 Correct 180 ms 79188 KB Output is correct
10 Correct 135 ms 78756 KB Output is correct
11 Correct 105 ms 78764 KB Output is correct
12 Correct 154 ms 78888 KB Output is correct
13 Correct 229 ms 79652 KB Output is correct
14 Correct 125 ms 79740 KB Output is correct
15 Correct 150 ms 78752 KB Output is correct
16 Correct 180 ms 78752 KB Output is correct
17 Correct 142 ms 78880 KB Output is correct
18 Correct 215 ms 79008 KB Output is correct
19 Correct 81 ms 78776 KB Output is correct
20 Correct 186 ms 79420 KB Output is correct
21 Correct 129 ms 79816 KB Output is correct
22 Correct 222 ms 80252 KB Output is correct
23 Correct 100 ms 79692 KB Output is correct
24 Correct 83 ms 79540 KB Output is correct
25 Correct 136 ms 79596 KB Output is correct
26 Correct 137 ms 79708 KB Output is correct
27 Correct 210 ms 79820 KB Output is correct
28 Correct 84 ms 79584 KB Output is correct
29 Correct 206 ms 80228 KB Output is correct
30 Correct 169 ms 79948 KB Output is correct
31 Correct 97 ms 79436 KB Output is correct
32 Correct 108 ms 79468 KB Output is correct
33 Correct 101 ms 79464 KB Output is correct
34 Correct 158 ms 79692 KB Output is correct
35 Correct 86 ms 79608 KB Output is correct
36 Correct 195 ms 80076 KB Output is correct
37 Correct 103 ms 80172 KB Output is correct
38 Correct 206 ms 79460 KB Output is correct
39 Correct 101 ms 79600 KB Output is correct
40 Correct 140 ms 79436 KB Output is correct
41 Correct 131 ms 79780 KB Output is correct
42 Correct 184 ms 79692 KB Output is correct