Submission #134062

# Submission time Handle Problem Language Result Execution time Memory
134062 2019-07-22T03:46:04 Z wzy Brunhilda’s Birthday (BOI13_brunhilda) C++11
0 / 100
280 ms 262148 KB
#include <bits/stdc++.h>
using namespace std;
const int N = 100002;
#define pii pair<int,int> 
const int MX = 10000005;
int primes[N] , querys[N];
int m , q;
int dp[MX];
vector<int> dq[MX];
// valores formam sequencia (0 , 1 , 2, 3 ,...)
// pega o menor multiplo menor que i 
int32_t main(){
	scanf("%d%d" , &m , &q);
	for(int i = 0 ; i < MX ;i ++){
		dp[i] = 1000000000;
	}
	for(int i = 0 ; i < m ; i ++){
		scanf("%d" , &primes[i]);
		dq[0].push_back(primes[i]);
	}
	dp[0] = 0;
	int curr = 0;	
	for(int i = 0 ; i < MX ; i ++){
		for(auto w : dq[i]){
			int u = i + w;
			curr = max(curr, i+1);
			for(int j = curr; j < min(u , MX) ; j++){
				dp[j] = dp[i] + 1;
			}
			curr = max(curr, u);
			if(u < MX) dq[u].push_back(w);
		}
		dq[i].clear();
	}
	for(int i = 0 ; i < q; i ++){
		int x;
		scanf("%d" , &x);
		int u = dp[x];
		if(u >= 1000000000){
			printf("oo\n");
		}
		else{
			printf("%d\n" , u);
		}
	}
}

Compilation message

brunhilda.cpp: In function 'int32_t main()':
brunhilda.cpp:13: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:18:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d" , &primes[i]);
   ~~~~~^~~~~~~~~~~~~~~~~~~
brunhilda.cpp:37:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d" , &x);
   ~~~~~^~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Runtime error 222 ms 262148 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Runtime error 211 ms 262144 KB Execution killed with signal 9 (could be triggered by violating memory limits)
3 Runtime error 213 ms 262144 KB Execution killed with signal 9 (could be triggered by violating memory limits)
4 Runtime error 213 ms 262148 KB Execution killed with signal 9 (could be triggered by violating memory limits)
5 Runtime error 206 ms 262144 KB Execution killed with signal 9 (could be triggered by violating memory limits)
6 Runtime error 215 ms 262148 KB Execution killed with signal 9 (could be triggered by violating memory limits)
7 Runtime error 242 ms 262148 KB Execution killed with signal 9 (could be triggered by violating memory limits)
8 Runtime error 213 ms 262144 KB Execution killed with signal 9 (could be triggered by violating memory limits)
9 Runtime error 219 ms 262148 KB Execution killed with signal 9 (could be triggered by violating memory limits)
10 Runtime error 215 ms 262148 KB Execution killed with signal 9 (could be triggered by violating memory limits)
11 Runtime error 213 ms 262144 KB Execution killed with signal 9 (could be triggered by violating memory limits)
12 Runtime error 212 ms 262144 KB Execution killed with signal 9 (could be triggered by violating memory limits)
13 Runtime error 211 ms 262148 KB Execution killed with signal 9 (could be triggered by violating memory limits)
14 Runtime error 211 ms 262148 KB Execution killed with signal 9 (could be triggered by violating memory limits)
15 Runtime error 280 ms 262144 KB Execution killed with signal 9 (could be triggered by violating memory limits)
16 Runtime error 211 ms 262148 KB Execution killed with signal 9 (could be triggered by violating memory limits)
17 Runtime error 211 ms 262148 KB Execution killed with signal 9 (could be triggered by violating memory limits)
18 Runtime error 218 ms 262148 KB Execution killed with signal 9 (could be triggered by violating memory limits)
# Verdict Execution time Memory Grader output
1 Runtime error 213 ms 262148 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Runtime error 216 ms 262148 KB Execution killed with signal 9 (could be triggered by violating memory limits)
3 Runtime error 213 ms 262144 KB Execution killed with signal 9 (could be triggered by violating memory limits)
4 Runtime error 228 ms 262148 KB Execution killed with signal 9 (could be triggered by violating memory limits)
5 Runtime error 239 ms 262148 KB Execution killed with signal 9 (could be triggered by violating memory limits)
6 Runtime error 223 ms 262148 KB Execution killed with signal 9 (could be triggered by violating memory limits)
7 Runtime error 218 ms 262148 KB Execution killed with signal 9 (could be triggered by violating memory limits)
8 Runtime error 215 ms 262148 KB Execution killed with signal 9 (could be triggered by violating memory limits)
9 Runtime error 216 ms 262148 KB Execution killed with signal 9 (could be triggered by violating memory limits)
10 Runtime error 214 ms 262148 KB Execution killed with signal 9 (could be triggered by violating memory limits)
11 Runtime error 231 ms 262148 KB Execution killed with signal 9 (could be triggered by violating memory limits)
12 Runtime error 215 ms 262148 KB Execution killed with signal 9 (could be triggered by violating memory limits)
13 Runtime error 216 ms 262148 KB Execution killed with signal 9 (could be triggered by violating memory limits)
14 Runtime error 214 ms 262144 KB Execution killed with signal 9 (could be triggered by violating memory limits)
15 Runtime error 219 ms 262148 KB Execution killed with signal 9 (could be triggered by violating memory limits)
16 Runtime error 213 ms 262148 KB Execution killed with signal 9 (could be triggered by violating memory limits)
17 Runtime error 220 ms 262148 KB Execution killed with signal 9 (could be triggered by violating memory limits)
18 Runtime error 210 ms 262144 KB Execution killed with signal 9 (could be triggered by violating memory limits)
# Verdict Execution time Memory Grader output
1 Runtime error 219 ms 262144 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Runtime error 215 ms 262148 KB Execution killed with signal 9 (could be triggered by violating memory limits)
3 Runtime error 215 ms 262144 KB Execution killed with signal 9 (could be triggered by violating memory limits)
4 Runtime error 217 ms 262148 KB Execution killed with signal 9 (could be triggered by violating memory limits)
5 Runtime error 212 ms 262148 KB Execution killed with signal 9 (could be triggered by violating memory limits)
6 Runtime error 218 ms 262148 KB Execution killed with signal 9 (could be triggered by violating memory limits)
7 Runtime error 212 ms 262148 KB Execution killed with signal 9 (could be triggered by violating memory limits)
8 Runtime error 218 ms 262144 KB Execution killed with signal 9 (could be triggered by violating memory limits)
9 Runtime error 228 ms 262148 KB Execution killed with signal 9 (could be triggered by violating memory limits)
10 Runtime error 214 ms 262148 KB Execution killed with signal 9 (could be triggered by violating memory limits)
11 Runtime error 215 ms 262144 KB Execution killed with signal 9 (could be triggered by violating memory limits)
12 Runtime error 212 ms 262148 KB Execution killed with signal 9 (could be triggered by violating memory limits)
13 Runtime error 220 ms 262148 KB Execution killed with signal 9 (could be triggered by violating memory limits)
14 Runtime error 268 ms 262148 KB Execution killed with signal 9 (could be triggered by violating memory limits)
15 Runtime error 215 ms 262148 KB Execution killed with signal 9 (could be triggered by violating memory limits)
16 Runtime error 242 ms 262148 KB Execution killed with signal 9 (could be triggered by violating memory limits)
17 Runtime error 232 ms 262148 KB Execution killed with signal 9 (could be triggered by violating memory limits)
18 Runtime error 214 ms 262148 KB Execution killed with signal 9 (could be triggered by violating memory limits)
19 Runtime error 215 ms 262144 KB Execution killed with signal 9 (could be triggered by violating memory limits)
20 Runtime error 216 ms 262148 KB Execution killed with signal 9 (could be triggered by violating memory limits)
21 Runtime error 213 ms 262148 KB Execution killed with signal 9 (could be triggered by violating memory limits)
22 Runtime error 220 ms 262148 KB Execution killed with signal 9 (could be triggered by violating memory limits)
23 Runtime error 215 ms 262148 KB Execution killed with signal 9 (could be triggered by violating memory limits)
24 Runtime error 218 ms 262148 KB Execution killed with signal 9 (could be triggered by violating memory limits)
25 Runtime error 215 ms 262148 KB Execution killed with signal 9 (could be triggered by violating memory limits)
26 Runtime error 219 ms 262148 KB Execution killed with signal 9 (could be triggered by violating memory limits)
27 Runtime error 212 ms 262144 KB Execution killed with signal 9 (could be triggered by violating memory limits)
28 Runtime error 221 ms 262148 KB Execution killed with signal 9 (could be triggered by violating memory limits)
29 Runtime error 215 ms 262148 KB Execution killed with signal 9 (could be triggered by violating memory limits)
30 Runtime error 218 ms 262148 KB Execution killed with signal 9 (could be triggered by violating memory limits)
31 Runtime error 262 ms 262148 KB Execution killed with signal 9 (could be triggered by violating memory limits)
32 Runtime error 229 ms 262144 KB Execution killed with signal 9 (could be triggered by violating memory limits)
33 Runtime error 218 ms 262148 KB Execution killed with signal 9 (could be triggered by violating memory limits)
34 Runtime error 212 ms 262148 KB Execution killed with signal 9 (could be triggered by violating memory limits)
35 Runtime error 216 ms 262144 KB Execution killed with signal 9 (could be triggered by violating memory limits)
36 Runtime error 213 ms 262144 KB Execution killed with signal 9 (could be triggered by violating memory limits)
37 Runtime error 223 ms 262144 KB Execution killed with signal 9 (could be triggered by violating memory limits)
38 Runtime error 215 ms 262148 KB Execution killed with signal 9 (could be triggered by violating memory limits)
39 Runtime error 219 ms 262148 KB Execution killed with signal 9 (could be triggered by violating memory limits)
40 Runtime error 215 ms 262148 KB Execution killed with signal 9 (could be triggered by violating memory limits)
41 Runtime error 235 ms 262148 KB Execution killed with signal 9 (could be triggered by violating memory limits)
42 Runtime error 213 ms 262148 KB Execution killed with signal 9 (could be triggered by violating memory limits)