답안 #121577

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
121577 2019-06-26T19:34:40 Z Adhyyan1252 Brunhilda’s Birthday (BOI13_brunhilda) C++11
49.2063 / 100
710 ms 41720 KB
#include<bits/stdc++.h>

using namespace std;

int main(){
	ios::sync_with_stdio(false); cin.tie(0);
	int m, q; cin>>m>>q;
	vector<int> p(m);
	for(int i = 0; i < m; i++){
		cin>>p[i];
	}
	vector<int> pd;
	for(int i = m-1; i >= 0 && i >= m-10; i--){
		pd.push_back(p[i]);
	}
	vector<int> dp(1e7+1, 1e7*2);
	dp[0] = 0;
	for(int i = 1; i < p.back(); i++) dp[i] = 1;
	for(int i = p.back(); i < dp.size(); i++){
		dp[i] = 1e7*2;
		for(int j : pd){
			dp[i] = min(dp[i], dp[i-i%j]+1);
		}
	}
	for(int i = 0; i < q; i++){
		int j; cin>>j;
		if(dp[j] > 1e7){
			cout<<"oo\n";
		}else{
			cout<<dp[j]<<"\n";
		}
	}
	cout.flush();
}

Compilation message

brunhilda.cpp: In function 'int main()':
brunhilda.cpp:19:26: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i = p.back(); i < dp.size(); i++){
                        ~~^~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 187 ms 39672 KB Output is correct
2 Correct 503 ms 39416 KB Output is correct
3 Correct 407 ms 39644 KB Output is correct
4 Incorrect 499 ms 39672 KB Output isn't correct
5 Correct 495 ms 39536 KB Output is correct
6 Correct 188 ms 39416 KB Output is correct
7 Correct 280 ms 39528 KB Output is correct
8 Correct 324 ms 39544 KB Output is correct
9 Correct 495 ms 39544 KB Output is correct
10 Correct 503 ms 39544 KB Output is correct
11 Correct 505 ms 39544 KB Output is correct
12 Correct 502 ms 39552 KB Output is correct
13 Correct 502 ms 39544 KB Output is correct
14 Correct 507 ms 39548 KB Output is correct
15 Correct 502 ms 39544 KB Output is correct
16 Correct 501 ms 39536 KB Output is correct
17 Incorrect 511 ms 39644 KB Output isn't correct
18 Incorrect 498 ms 39672 KB Output isn't correct
# 결과 실행 시간 메모리 Grader output
1 Correct 465 ms 39672 KB Output is correct
2 Correct 94 ms 40696 KB Output is correct
3 Correct 402 ms 40208 KB Output is correct
4 Incorrect 498 ms 39672 KB Output isn't correct
5 Correct 449 ms 40056 KB Output is correct
6 Incorrect 502 ms 39560 KB Output isn't correct
7 Correct 464 ms 39772 KB Output is correct
8 Incorrect 503 ms 39544 KB Output isn't correct
9 Correct 453 ms 40440 KB Output is correct
10 Correct 395 ms 40292 KB Output is correct
11 Incorrect 470 ms 40104 KB Output isn't correct
12 Incorrect 509 ms 39548 KB Output isn't correct
13 Incorrect 479 ms 39544 KB Output isn't correct
14 Incorrect 490 ms 39676 KB Output isn't correct
15 Correct 463 ms 40000 KB Output is correct
16 Correct 95 ms 40740 KB Output is correct
17 Correct 489 ms 39572 KB Output is correct
18 Incorrect 359 ms 40720 KB Output isn't correct
# 결과 실행 시간 메모리 Grader output
1 Correct 498 ms 40504 KB Output is correct
2 Incorrect 488 ms 40312 KB Output isn't correct
3 Correct 464 ms 40668 KB Output is correct
4 Incorrect 524 ms 40440 KB Output isn't correct
5 Correct 324 ms 41720 KB Output is correct
6 Incorrect 516 ms 40568 KB Output isn't correct
7 Correct 383 ms 41208 KB Output is correct
8 Correct 475 ms 40444 KB Output is correct
9 Correct 478 ms 40404 KB Output is correct
10 Incorrect 500 ms 39680 KB Output isn't correct
11 Incorrect 542 ms 39772 KB Output isn't correct
12 Incorrect 499 ms 39928 KB Output isn't correct
13 Incorrect 710 ms 40808 KB Output isn't correct
14 Incorrect 512 ms 40828 KB Output isn't correct
15 Incorrect 496 ms 39800 KB Output isn't correct
16 Incorrect 501 ms 39796 KB Output isn't correct
17 Incorrect 471 ms 40184 KB Output isn't correct
18 Incorrect 480 ms 40312 KB Output isn't correct
19 Incorrect 477 ms 39800 KB Output isn't correct
20 Correct 471 ms 40628 KB Output is correct
21 Incorrect 514 ms 40956 KB Output isn't correct
22 Correct 467 ms 41720 KB Output is correct
23 Incorrect 478 ms 40796 KB Output isn't correct
24 Incorrect 516 ms 40568 KB Output isn't correct
25 Incorrect 533 ms 40568 KB Output isn't correct
26 Incorrect 513 ms 40568 KB Output isn't correct
27 Correct 433 ms 41080 KB Output is correct
28 Incorrect 504 ms 40696 KB Output isn't correct
29 Correct 463 ms 41592 KB Output is correct
30 Correct 485 ms 41336 KB Output is correct
31 Incorrect 502 ms 40312 KB Output isn't correct
32 Incorrect 525 ms 40668 KB Output isn't correct
33 Incorrect 523 ms 40568 KB Output isn't correct
34 Correct 378 ms 41180 KB Output is correct
35 Incorrect 503 ms 40696 KB Output isn't correct
36 Correct 465 ms 41464 KB Output is correct
37 Correct 330 ms 41636 KB Output is correct
38 Incorrect 526 ms 40572 KB Output isn't correct
39 Incorrect 519 ms 40612 KB Output isn't correct
40 Incorrect 527 ms 40708 KB Output isn't correct
41 Correct 180 ms 41180 KB Output is correct
42 Incorrect 516 ms 40824 KB Output isn't correct