답안 #318115

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
318115 2020-10-31T13:11:06 Z shivensinha4 Brunhilda’s Birthday (BOI13_brunhilda) C++17
97.7778 / 100
694 ms 157540 KB
#include "bits/stdc++.h"
using namespace std; 
#define for_(i, s, e) for (int i = s; i < (int) e; i++)
#define for__(i, s, e) for (ll i = s; i < e; i++)
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
#define endl '\n'

const int MXN = (1e7)+9999992;
int jmp[MXN+2], ans[MXN+2];

int main() {
	#ifdef shiven
	freopen("test.in", "r", stdin);
	#endif
	
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	
	int m, q; cin >> m >> q;
	for_(i, 0, m) {
		int k; cin >> k;
		for (int j = k; j <= MXN; j += k) {
			jmp[j-1] = max(jmp[j-1], k-1);
		}
	}
	
	for (int i = MXN; i >= 0; i--) jmp[i] = max(jmp[i], jmp[i+1]-1);
	
	for_(i, 1, MXN+1) if (jmp[i]) ans[i] = ans[i-jmp[i]]+1;
	
	for_(i, 0, q) {
		int k; cin >> k;
		if (ans[k]) cout << ans[k];
		else cout << "oo";
		cout << endl;
	}

	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 212 ms 156904 KB Output isn't correct
2 Correct 266 ms 156900 KB Output is correct
3 Correct 238 ms 156900 KB Output is correct
4 Correct 219 ms 156900 KB Output is correct
5 Correct 241 ms 156900 KB Output is correct
6 Incorrect 214 ms 156900 KB Output isn't correct
7 Correct 236 ms 156900 KB Output is correct
8 Correct 247 ms 156900 KB Output is correct
9 Correct 281 ms 157028 KB Output is correct
10 Correct 320 ms 156900 KB Output is correct
11 Correct 303 ms 156904 KB Output is correct
12 Correct 212 ms 156900 KB Output is correct
13 Correct 507 ms 156900 KB Output is correct
14 Correct 510 ms 156900 KB Output is correct
15 Correct 284 ms 156900 KB Output is correct
16 Correct 262 ms 156900 KB Output is correct
17 Correct 265 ms 156900 KB Output is correct
18 Correct 214 ms 156900 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 250 ms 156900 KB Output is correct
2 Correct 272 ms 156900 KB Output is correct
3 Correct 625 ms 156884 KB Output is correct
4 Correct 291 ms 156900 KB Output is correct
5 Correct 443 ms 156996 KB Output is correct
6 Correct 258 ms 156900 KB Output is correct
7 Correct 248 ms 156904 KB Output is correct
8 Correct 289 ms 156900 KB Output is correct
9 Correct 516 ms 156896 KB Output is correct
10 Correct 627 ms 156900 KB Output is correct
11 Correct 616 ms 156880 KB Output is correct
12 Correct 359 ms 156900 KB Output is correct
13 Correct 227 ms 156900 KB Output is correct
14 Correct 290 ms 156900 KB Output is correct
15 Correct 515 ms 156900 KB Output is correct
16 Correct 275 ms 156900 KB Output is correct
17 Correct 531 ms 156904 KB Output is correct
18 Correct 510 ms 156900 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 525 ms 157028 KB Output is correct
2 Correct 643 ms 156900 KB Output is correct
3 Correct 637 ms 157028 KB Output is correct
4 Correct 398 ms 157156 KB Output is correct
5 Correct 313 ms 157076 KB Output is correct
6 Correct 522 ms 157156 KB Output is correct
7 Correct 468 ms 157028 KB Output is correct
8 Correct 523 ms 157028 KB Output is correct
9 Correct 516 ms 157028 KB Output is correct
10 Correct 426 ms 156900 KB Output is correct
11 Correct 377 ms 156900 KB Output is correct
12 Correct 480 ms 156896 KB Output is correct
13 Correct 605 ms 157156 KB Output is correct
14 Correct 361 ms 157412 KB Output is correct
15 Correct 504 ms 157028 KB Output is correct
16 Correct 562 ms 156900 KB Output is correct
17 Correct 509 ms 156960 KB Output is correct
18 Correct 639 ms 156900 KB Output is correct
19 Correct 247 ms 156904 KB Output is correct
20 Correct 639 ms 157008 KB Output is correct
21 Correct 413 ms 157540 KB Output is correct
22 Correct 647 ms 157156 KB Output is correct
23 Correct 315 ms 157156 KB Output is correct
24 Correct 267 ms 157176 KB Output is correct
25 Correct 435 ms 157264 KB Output is correct
26 Correct 394 ms 157156 KB Output is correct
27 Correct 694 ms 157008 KB Output is correct
28 Correct 268 ms 157156 KB Output is correct
29 Correct 619 ms 157140 KB Output is correct
30 Correct 567 ms 157156 KB Output is correct
31 Correct 303 ms 157284 KB Output is correct
32 Correct 339 ms 157156 KB Output is correct
33 Correct 241 ms 157156 KB Output is correct
34 Correct 467 ms 157028 KB Output is correct
35 Correct 284 ms 157264 KB Output is correct
36 Correct 627 ms 157156 KB Output is correct
37 Correct 317 ms 157156 KB Output is correct
38 Correct 522 ms 157156 KB Output is correct
39 Correct 286 ms 157256 KB Output is correct
40 Correct 457 ms 157284 KB Output is correct
41 Correct 422 ms 157028 KB Output is correct
42 Correct 576 ms 157416 KB Output is correct