Submission #60766

# Submission time Handle Problem Language Result Execution time Memory
60766 2018-07-24T16:12:29 Z RezwanArefin01 Brunhilda’s Birthday (BOI13_brunhilda) C++17
20 / 100
1000 ms 71560 KB
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<int, int> ii; 

const int M = 1e5 + 10; 
const int N = 1e7 + 1; 
int p[M], dp[N], m, q; 

int main(int argc, char const *argv[]) {
	scanf("%d %d", &m, &q); 
	for(int i = 1; i <= m; i++) 
		scanf("%d", &p[i]); 
	memset(dp, 127, sizeof dp); 
	dp[0] = 0;
	for(int i = 1; i <= 10000; i++) {
		for(int j = 1; j <= m; j++) {
			dp[i] = min(dp[i], dp[(i / p[j]) * p[j]] + 1); 
		}
	}
	while(q--) {
		int ni; scanf("%d", &ni); 
		if(dp[ni] > 10000) puts("oo"); 
		else printf("%d\n", dp[ni]);
	}
}

Compilation message

brunhilda.cpp: In function 'int main(int, const char**)':
brunhilda.cpp:12:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d %d", &m, &q); 
  ~~~~~^~~~~~~~~~~~~~~~~
brunhilda.cpp:14:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d", &p[i]); 
   ~~~~~^~~~~~~~~~~~~
brunhilda.cpp:23:16: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   int ni; scanf("%d", &ni); 
           ~~~~~^~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 39 ms 39416 KB Output is correct
2 Correct 41 ms 39532 KB Output is correct
3 Correct 37 ms 39572 KB Output is correct
4 Correct 43 ms 39768 KB Output is correct
5 Correct 34 ms 39768 KB Output is correct
6 Correct 40 ms 39768 KB Output is correct
7 Correct 38 ms 39768 KB Output is correct
8 Correct 37 ms 39828 KB Output is correct
9 Correct 37 ms 39876 KB Output is correct
10 Correct 39 ms 39876 KB Output is correct
11 Correct 36 ms 39876 KB Output is correct
12 Correct 45 ms 39904 KB Output is correct
13 Correct 119 ms 40016 KB Output is correct
14 Correct 138 ms 40068 KB Output is correct
15 Correct 41 ms 40068 KB Output is correct
16 Correct 42 ms 40068 KB Output is correct
17 Correct 39 ms 40152 KB Output is correct
18 Correct 41 ms 40172 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 750 ms 40220 KB Output isn't correct
2 Execution timed out 1070 ms 41332 KB Time limit exceeded
3 Execution timed out 1063 ms 41648 KB Time limit exceeded
4 Incorrect 311 ms 41648 KB Output isn't correct
5 Execution timed out 1081 ms 41884 KB Time limit exceeded
6 Incorrect 144 ms 41884 KB Output isn't correct
7 Incorrect 820 ms 41956 KB Output isn't correct
8 Incorrect 95 ms 41956 KB Output isn't correct
9 Execution timed out 1074 ms 42596 KB Time limit exceeded
10 Execution timed out 1086 ms 43128 KB Time limit exceeded
11 Execution timed out 1083 ms 43364 KB Time limit exceeded
12 Incorrect 173 ms 43364 KB Output isn't correct
13 Incorrect 232 ms 43364 KB Output isn't correct
14 Incorrect 249 ms 43364 KB Output isn't correct
15 Execution timed out 1076 ms 43644 KB Time limit exceeded
16 Execution timed out 1073 ms 44544 KB Time limit exceeded
17 Incorrect 248 ms 44544 KB Output isn't correct
18 Execution timed out 1079 ms 45292 KB Time limit exceeded
# Verdict Execution time Memory Grader output
1 Execution timed out 1063 ms 45712 KB Time limit exceeded
2 Execution timed out 1087 ms 46124 KB Time limit exceeded
3 Execution timed out 1079 ms 46620 KB Time limit exceeded
4 Incorrect 313 ms 47372 KB Output isn't correct
5 Execution timed out 1073 ms 48324 KB Time limit exceeded
6 Incorrect 552 ms 49204 KB Output isn't correct
7 Execution timed out 1060 ms 50096 KB Time limit exceeded
8 Execution timed out 1076 ms 50340 KB Time limit exceeded
9 Execution timed out 1090 ms 50828 KB Time limit exceeded
10 Incorrect 384 ms 50828 KB Output isn't correct
11 Incorrect 332 ms 50940 KB Output isn't correct
12 Incorrect 380 ms 51280 KB Output isn't correct
13 Execution timed out 1053 ms 51596 KB Time limit exceeded
14 Incorrect 67 ms 52476 KB Output isn't correct
15 Incorrect 466 ms 52596 KB Output isn't correct
16 Incorrect 493 ms 52820 KB Output isn't correct
17 Execution timed out 1091 ms 53284 KB Time limit exceeded
18 Execution timed out 1074 ms 53800 KB Time limit exceeded
19 Incorrect 386 ms 53800 KB Output isn't correct
20 Execution timed out 1080 ms 54500 KB Time limit exceeded
21 Incorrect 72 ms 55380 KB Output isn't correct
22 Execution timed out 1075 ms 56272 KB Time limit exceeded
23 Execution timed out 1071 ms 56404 KB Time limit exceeded
24 Incorrect 170 ms 57412 KB Output isn't correct
25 Incorrect 272 ms 58164 KB Output isn't correct
26 Incorrect 297 ms 58792 KB Output isn't correct
27 Execution timed out 1080 ms 59872 KB Time limit exceeded
28 Incorrect 113 ms 60496 KB Output isn't correct
29 Execution timed out 1084 ms 61424 KB Time limit exceeded
30 Execution timed out 1080 ms 61908 KB Time limit exceeded
31 Incorrect 365 ms 62788 KB Output isn't correct
32 Incorrect 246 ms 63352 KB Output isn't correct
33 Incorrect 138 ms 64084 KB Output isn't correct
34 Execution timed out 1057 ms 65112 KB Time limit exceeded
35 Incorrect 204 ms 65912 KB Output isn't correct
36 Execution timed out 1067 ms 66700 KB Time limit exceeded
37 Execution timed out 1067 ms 67604 KB Time limit exceeded
38 Incorrect 552 ms 68432 KB Output isn't correct
39 Incorrect 207 ms 69264 KB Output isn't correct
40 Incorrect 608 ms 69896 KB Output isn't correct
41 Execution timed out 1090 ms 70808 KB Time limit exceeded
42 Incorrect 273 ms 71560 KB Output isn't correct