답안 #46996

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

const int P = 1e6+10;
const int M = 1e5+10;
int mx;
vector<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 Correct 45 ms 33020 KB Output is correct
2 Correct 117 ms 50532 KB Output is correct
3 Correct 91 ms 50532 KB Output is correct
4 Correct 56 ms 50532 KB Output is correct
5 Correct 61 ms 50532 KB Output is correct
6 Correct 45 ms 50532 KB Output is correct
7 Correct 92 ms 50532 KB Output is correct
8 Correct 118 ms 51552 KB Output is correct
9 Correct 144 ms 53660 KB Output is correct
10 Correct 156 ms 54504 KB Output is correct
11 Correct 127 ms 54504 KB Output is correct
12 Correct 36 ms 54504 KB Output is correct
13 Correct 251 ms 57476 KB Output is correct
14 Correct 249 ms 57600 KB Output is correct
15 Correct 118 ms 57600 KB Output is correct
16 Correct 135 ms 57600 KB Output is correct
17 Correct 83 ms 57600 KB Output is correct
18 Correct 56 ms 57600 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Runtime error 88 ms 66220 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Runtime error 110 ms 69264 KB Execution killed with signal 11 (could be triggered by violating memory limits)
3 Incorrect 339 ms 94368 KB Output isn't correct
4 Incorrect 109 ms 94368 KB Output isn't correct
5 Incorrect 205 ms 94368 KB Output isn't correct
6 Incorrect 106 ms 94368 KB Output isn't correct
7 Runtime error 91 ms 94368 KB Execution killed with signal 11 (could be triggered by violating memory limits)
8 Incorrect 96 ms 94368 KB Output isn't correct
9 Incorrect 237 ms 94368 KB Output isn't correct
10 Incorrect 307 ms 94368 KB Output isn't correct
11 Runtime error 296 ms 117084 KB Execution killed with signal 11 (could be triggered by violating memory limits)
12 Runtime error 190 ms 117084 KB Execution killed with signal 11 (could be triggered by violating memory limits)
13 Runtime error 99 ms 117084 KB Execution killed with signal 11 (could be triggered by violating memory limits)
14 Incorrect 104 ms 117084 KB Output isn't correct
15 Incorrect 255 ms 117084 KB Output isn't correct
16 Incorrect 77 ms 117084 KB Output isn't correct
17 Runtime error 252 ms 117084 KB Execution killed with signal 11 (could be triggered by violating memory limits)
18 Runtime error 263 ms 117084 KB Execution killed with signal 11 (could be triggered by violating memory limits)
# 결과 실행 시간 메모리 Grader output
1 Runtime error 279 ms 117084 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Runtime error 325 ms 118364 KB Execution killed with signal 11 (could be triggered by violating memory limits)
3 Runtime error 339 ms 118364 KB Execution killed with signal 11 (could be triggered by violating memory limits)
4 Runtime error 293 ms 118364 KB Execution killed with signal 11 (could be triggered by violating memory limits)
5 Incorrect 260 ms 118364 KB Output isn't correct
6 Runtime error 253 ms 118364 KB Execution killed with signal 11 (could be triggered by violating memory limits)
7 Runtime error 223 ms 118364 KB Execution killed with signal 11 (could be triggered by violating memory limits)
8 Runtime error 280 ms 118364 KB Execution killed with signal 11 (could be triggered by violating memory limits)
9 Runtime error 289 ms 118364 KB Execution killed with signal 11 (could be triggered by violating memory limits)
10 Runtime error 189 ms 118364 KB Execution killed with signal 11 (could be triggered by violating memory limits)
11 Runtime error 162 ms 118364 KB Execution killed with signal 11 (could be triggered by violating memory limits)
12 Runtime error 246 ms 118364 KB Execution killed with signal 11 (could be triggered by violating memory limits)
13 Incorrect 467 ms 118364 KB Output isn't correct
14 Incorrect 318 ms 118364 KB Output isn't correct
15 Runtime error 292 ms 118364 KB Execution killed with signal 11 (could be triggered by violating memory limits)
16 Runtime error 312 ms 118364 KB Execution killed with signal 11 (could be triggered by violating memory limits)
17 Runtime error 267 ms 118364 KB Execution killed with signal 11 (could be triggered by violating memory limits)
18 Runtime error 383 ms 118900 KB Execution killed with signal 11 (could be triggered by violating memory limits)
19 Runtime error 124 ms 118900 KB Execution killed with signal 11 (could be triggered by violating memory limits)
20 Runtime error 344 ms 118900 KB Execution killed with signal 11 (could be triggered by violating memory limits)
21 Runtime error 229 ms 118900 KB Execution killed with signal 11 (could be triggered by violating memory limits)
22 Runtime error 370 ms 119840 KB Execution killed with signal 11 (could be triggered by violating memory limits)
23 Runtime error 128 ms 119840 KB Execution killed with signal 11 (could be triggered by violating memory limits)
24 Runtime error 102 ms 119840 KB Execution killed with signal 11 (could be triggered by violating memory limits)
25 Runtime error 209 ms 119840 KB Execution killed with signal 11 (could be triggered by violating memory limits)
26 Runtime error 206 ms 119840 KB Execution killed with signal 11 (could be triggered by violating memory limits)
27 Runtime error 375 ms 121448 KB Execution killed with signal 11 (could be triggered by violating memory limits)
28 Runtime error 116 ms 121448 KB Execution killed with signal 11 (could be triggered by violating memory limits)
29 Runtime error 269 ms 121448 KB Execution killed with signal 11 (could be triggered by violating memory limits)
30 Runtime error 281 ms 121448 KB Execution killed with signal 11 (could be triggered by violating memory limits)
31 Runtime error 136 ms 121448 KB Execution killed with signal 11 (could be triggered by violating memory limits)
32 Runtime error 151 ms 121448 KB Execution killed with signal 11 (could be triggered by violating memory limits)
33 Runtime error 84 ms 121448 KB Execution killed with signal 11 (could be triggered by violating memory limits)
34 Runtime error 238 ms 121448 KB Execution killed with signal 11 (could be triggered by violating memory limits)
35 Runtime error 140 ms 121448 KB Execution killed with signal 11 (could be triggered by violating memory limits)
36 Runtime error 329 ms 121448 KB Execution killed with signal 11 (could be triggered by violating memory limits)
37 Runtime error 125 ms 121448 KB Execution killed with signal 11 (could be triggered by violating memory limits)
38 Runtime error 267 ms 121448 KB Execution killed with signal 11 (could be triggered by violating memory limits)
39 Runtime error 110 ms 121448 KB Execution killed with signal 11 (could be triggered by violating memory limits)
40 Runtime error 260 ms 121448 KB Execution killed with signal 11 (could be triggered by violating memory limits)
41 Runtime error 245 ms 121448 KB Execution killed with signal 11 (could be triggered by violating memory limits)
42 Runtime error 278 ms 121448 KB Execution killed with signal 11 (could be triggered by violating memory limits)