답안 #46997

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
46997 2018-04-25T22:21:28 Z rsalesc Brunhilda’s Birthday (BOI13_brunhilda) C++14
0 / 100
3 ms 556 KB
#include <bits/stdc++.h>
using namespace std;

const int P = 1e7+10;
const int M = 1e5+10;

int mx;
list<int> q[P];
int dp[P];

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int m, Q;
	cin >> m >> Q;

	for(int i = 0; i < m; i++) {
		int x;
		cin >> x;
		q[0].push_back(x);
	}

	for(int i = 1; i < P; i++) dp[i] = 1e9+10;

	for(int i = 0; i < P; i++) {
		for(int p : q[i]) {
			int nxt = i+p;
			int til = min(nxt, P);

			for(int j = max(mx, i+1); j < til; j++) {
				dp[j] = dp[i]+1;
			}

			mx = max(mx, nxt);
			if(nxt < P) q[nxt].push_back(p);
		}
		q[i].clear();
	}

	for(int i = 0; i < Q; i++) {
		int x;
		cin >> x;
		if(dp[x] > 1e9) cout << "oo" << endl;
		else cout << dp[x] << endl;
	}
}
# 결과 실행 시간 메모리 Grader output
1 Runtime error 2 ms 128 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Runtime error 3 ms 224 KB Execution killed with signal 11 (could be triggered by violating memory limits)
3 Runtime error 1 ms 272 KB Execution killed with signal 11 (could be triggered by violating memory limits)
4 Runtime error 1 ms 272 KB Execution killed with signal 11 (could be triggered by violating memory limits)
5 Runtime error 1 ms 272 KB Execution killed with signal 11 (could be triggered by violating memory limits)
6 Runtime error 1 ms 272 KB Execution killed with signal 11 (could be triggered by violating memory limits)
7 Runtime error 2 ms 300 KB Execution killed with signal 11 (could be triggered by violating memory limits)
8 Runtime error 1 ms 456 KB Execution killed with signal 11 (could be triggered by violating memory limits)
9 Runtime error 1 ms 460 KB Execution killed with signal 11 (could be triggered by violating memory limits)
10 Runtime error 1 ms 460 KB Execution killed with signal 11 (could be triggered by violating memory limits)
11 Runtime error 1 ms 492 KB Execution killed with signal 11 (could be triggered by violating memory limits)
12 Runtime error 1 ms 492 KB Execution killed with signal 11 (could be triggered by violating memory limits)
13 Runtime error 2 ms 528 KB Execution killed with signal 11 (could be triggered by violating memory limits)
14 Runtime error 2 ms 528 KB Execution killed with signal 11 (could be triggered by violating memory limits)
15 Runtime error 2 ms 548 KB Execution killed with signal 11 (could be triggered by violating memory limits)
16 Runtime error 2 ms 548 KB Execution killed with signal 11 (could be triggered by violating memory limits)
17 Runtime error 2 ms 548 KB Execution killed with signal 11 (could be triggered by violating memory limits)
18 Runtime error 2 ms 548 KB Execution killed with signal 11 (could be triggered by violating memory limits)
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 548 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Runtime error 2 ms 548 KB Execution killed with signal 11 (could be triggered by violating memory limits)
3 Runtime error 1 ms 548 KB Execution killed with signal 11 (could be triggered by violating memory limits)
4 Runtime error 1 ms 556 KB Execution killed with signal 11 (could be triggered by violating memory limits)
5 Runtime error 1 ms 556 KB Execution killed with signal 11 (could be triggered by violating memory limits)
6 Runtime error 2 ms 556 KB Execution killed with signal 11 (could be triggered by violating memory limits)
7 Runtime error 1 ms 556 KB Execution killed with signal 11 (could be triggered by violating memory limits)
8 Runtime error 1 ms 556 KB Execution killed with signal 11 (could be triggered by violating memory limits)
9 Runtime error 1 ms 556 KB Execution killed with signal 11 (could be triggered by violating memory limits)
10 Runtime error 1 ms 556 KB Execution killed with signal 11 (could be triggered by violating memory limits)
11 Runtime error 1 ms 556 KB Execution killed with signal 11 (could be triggered by violating memory limits)
12 Runtime error 1 ms 556 KB Execution killed with signal 11 (could be triggered by violating memory limits)
13 Runtime error 1 ms 556 KB Execution killed with signal 11 (could be triggered by violating memory limits)
14 Runtime error 1 ms 556 KB Execution killed with signal 11 (could be triggered by violating memory limits)
15 Runtime error 1 ms 556 KB Execution killed with signal 11 (could be triggered by violating memory limits)
16 Runtime error 1 ms 556 KB Execution killed with signal 11 (could be triggered by violating memory limits)
17 Runtime error 1 ms 556 KB Execution killed with signal 11 (could be triggered by violating memory limits)
18 Runtime error 1 ms 556 KB Execution killed with signal 11 (could be triggered by violating memory limits)
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 556 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Runtime error 1 ms 556 KB Execution killed with signal 11 (could be triggered by violating memory limits)
3 Runtime error 1 ms 556 KB Execution killed with signal 11 (could be triggered by violating memory limits)
4 Runtime error 2 ms 556 KB Execution killed with signal 11 (could be triggered by violating memory limits)
5 Runtime error 1 ms 556 KB Execution killed with signal 11 (could be triggered by violating memory limits)
6 Runtime error 1 ms 556 KB Execution killed with signal 11 (could be triggered by violating memory limits)
7 Runtime error 1 ms 556 KB Execution killed with signal 11 (could be triggered by violating memory limits)
8 Runtime error 1 ms 556 KB Execution killed with signal 11 (could be triggered by violating memory limits)
9 Runtime error 1 ms 556 KB Execution killed with signal 11 (could be triggered by violating memory limits)
10 Runtime error 1 ms 556 KB Execution killed with signal 11 (could be triggered by violating memory limits)
11 Runtime error 1 ms 556 KB Execution killed with signal 11 (could be triggered by violating memory limits)
12 Runtime error 2 ms 556 KB Execution killed with signal 11 (could be triggered by violating memory limits)
13 Runtime error 2 ms 556 KB Execution killed with signal 11 (could be triggered by violating memory limits)
14 Runtime error 1 ms 556 KB Execution killed with signal 11 (could be triggered by violating memory limits)
15 Runtime error 2 ms 556 KB Execution killed with signal 11 (could be triggered by violating memory limits)
16 Runtime error 1 ms 556 KB Execution killed with signal 11 (could be triggered by violating memory limits)
17 Runtime error 1 ms 556 KB Execution killed with signal 11 (could be triggered by violating memory limits)
18 Runtime error 1 ms 556 KB Execution killed with signal 11 (could be triggered by violating memory limits)
19 Runtime error 1 ms 556 KB Execution killed with signal 11 (could be triggered by violating memory limits)
20 Runtime error 1 ms 556 KB Execution killed with signal 11 (could be triggered by violating memory limits)
21 Runtime error 1 ms 556 KB Execution killed with signal 11 (could be triggered by violating memory limits)
22 Runtime error 1 ms 556 KB Execution killed with signal 11 (could be triggered by violating memory limits)
23 Runtime error 1 ms 556 KB Execution killed with signal 11 (could be triggered by violating memory limits)
24 Runtime error 1 ms 556 KB Execution killed with signal 11 (could be triggered by violating memory limits)
25 Runtime error 1 ms 556 KB Execution killed with signal 11 (could be triggered by violating memory limits)
26 Runtime error 1 ms 556 KB Execution killed with signal 11 (could be triggered by violating memory limits)
27 Runtime error 2 ms 556 KB Execution killed with signal 11 (could be triggered by violating memory limits)
28 Runtime error 2 ms 556 KB Execution killed with signal 11 (could be triggered by violating memory limits)
29 Runtime error 2 ms 556 KB Execution killed with signal 11 (could be triggered by violating memory limits)
30 Runtime error 1 ms 556 KB Execution killed with signal 11 (could be triggered by violating memory limits)
31 Runtime error 2 ms 556 KB Execution killed with signal 11 (could be triggered by violating memory limits)
32 Runtime error 2 ms 556 KB Execution killed with signal 11 (could be triggered by violating memory limits)
33 Runtime error 1 ms 556 KB Execution killed with signal 11 (could be triggered by violating memory limits)
34 Runtime error 1 ms 556 KB Execution killed with signal 11 (could be triggered by violating memory limits)
35 Runtime error 1 ms 556 KB Execution killed with signal 11 (could be triggered by violating memory limits)
36 Runtime error 1 ms 556 KB Execution killed with signal 11 (could be triggered by violating memory limits)
37 Runtime error 1 ms 556 KB Execution killed with signal 11 (could be triggered by violating memory limits)
38 Runtime error 2 ms 556 KB Execution killed with signal 11 (could be triggered by violating memory limits)
39 Runtime error 2 ms 556 KB Execution killed with signal 11 (could be triggered by violating memory limits)
40 Runtime error 2 ms 556 KB Execution killed with signal 11 (could be triggered by violating memory limits)
41 Runtime error 2 ms 556 KB Execution killed with signal 11 (could be triggered by violating memory limits)
42 Runtime error 2 ms 556 KB Execution killed with signal 11 (could be triggered by violating memory limits)