답안 #31850

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
31850 2017-09-11T07:25:50 Z ToMo01 Brunhilda’s Birthday (BOI13_brunhilda) C++14
13.3333 / 100
73 ms 66244 KB
/*input
2 2
2 3
5
6
*/
#include <bits/stdc++.h>
using namespace std;
const int N = 10000007;

int cost[N], p[100007], n, Q;
vector<pair<int, int> > v;

int main(){
	iostream::sync_with_stdio(false); cin.tie(0);
	cin >> n >> Q;
	for(int i = 1; i <= n; ++i)
		cin >> p[i];
	sort(p + 1, p + n + 1);

	for(int i = p[n] - 1; i > 0; --i)
		cost[i] = 1;

	for(int i = 1; i <= n; ++i)
		v.push_back({p[i], i});

	int l = 0;
	for(int i = 1; i < N; ++i){
		if(cost[i] == 1) continue;
		while(v[l].first + p[v[l].second] - 1 < i) v.push_back({v[l].first + p[v[l].second], v[l++].second});
		if(v[l].first < i) cost[i] = cost[v[l].first] + 1;
		else cost[i] = N;
	}	

	while(Q--){
		int x; cin >> x;
		if(cost[x] == N) cout << "oo\n";
		else cout << cost[x] << "\n";
	}
}

Compilation message

brunhilda.cpp: In function 'int main()':
brunhilda.cpp:30:103: warning: operation on 'l' may be undefined [-Wsequence-point]
   while(v[l].first + p[v[l].second] - 1 < i) v.push_back({v[l].first + p[v[l].second], v[l++].second});
                                                                                                       ^
brunhilda.cpp:30:103: warning: operation on 'l' may be undefined [-Wsequence-point]
# 결과 실행 시간 메모리 Grader output
1 Runtime error 63 ms 66244 KB Execution killed because of forbidden syscall writev (20)
2 Incorrect 49 ms 53956 KB Output isn't correct
3 Incorrect 43 ms 66244 KB Output isn't correct
4 Runtime error 33 ms 44740 KB Execution killed because of forbidden syscall writev (20)
5 Correct 43 ms 66244 KB Output is correct
6 Runtime error 49 ms 66244 KB Execution killed because of forbidden syscall writev (20)
7 Incorrect 49 ms 66244 KB Output isn't correct
8 Incorrect 43 ms 66244 KB Output isn't correct
9 Incorrect 53 ms 66244 KB Output isn't correct
10 Runtime error 29 ms 53956 KB Execution killed because of forbidden syscall writev (20)
11 Runtime error 46 ms 53956 KB Execution killed because of forbidden syscall writev (20)
12 Correct 33 ms 47812 KB Output is correct
13 Correct 49 ms 66244 KB Output is correct
14 Runtime error 39 ms 66244 KB Execution killed because of forbidden syscall writev (20)
15 Incorrect 49 ms 53956 KB Output isn't correct
16 Incorrect 39 ms 53956 KB Output isn't correct
17 Runtime error 23 ms 53956 KB Execution killed because of forbidden syscall writev (20)
18 Runtime error 23 ms 44740 KB Execution killed because of forbidden syscall writev (20)
# 결과 실행 시간 메모리 Grader output
1 Correct 56 ms 44740 KB Output is correct
2 Correct 36 ms 44740 KB Output is correct
3 Incorrect 43 ms 47812 KB Output isn't correct
4 Incorrect 36 ms 47812 KB Output isn't correct
5 Correct 23 ms 47812 KB Output is correct
6 Correct 29 ms 44740 KB Output is correct
7 Correct 33 ms 44740 KB Output is correct
8 Incorrect 29 ms 47812 KB Output isn't correct
9 Correct 53 ms 53956 KB Output is correct
10 Incorrect 49 ms 47812 KB Output isn't correct
11 Incorrect 43 ms 47812 KB Output isn't correct
12 Incorrect 39 ms 47812 KB Output isn't correct
13 Correct 36 ms 42436 KB Output is correct
14 Incorrect 26 ms 47812 KB Output isn't correct
15 Correct 39 ms 53956 KB Output is correct
16 Correct 33 ms 44740 KB Output is correct
17 Incorrect 13 ms 47812 KB Output isn't correct
18 Incorrect 36 ms 47812 KB Output isn't correct
# 결과 실행 시간 메모리 Grader output
1 Runtime error 59 ms 53956 KB Execution killed because of forbidden syscall writev (20)
2 Runtime error 43 ms 53956 KB Execution killed because of forbidden syscall writev (20)
3 Runtime error 49 ms 53956 KB Execution killed because of forbidden syscall writev (20)
4 Runtime error 59 ms 47812 KB Execution killed because of forbidden syscall writev (20)
5 Runtime error 49 ms 47812 KB Execution killed because of forbidden syscall writev (20)
6 Runtime error 46 ms 53956 KB Execution killed because of forbidden syscall writev (20)
7 Runtime error 43 ms 47812 KB Execution killed because of forbidden syscall writev (20)
8 Runtime error 56 ms 53956 KB Execution killed because of forbidden syscall writev (20)
9 Runtime error 56 ms 53956 KB Execution killed because of forbidden syscall writev (20)
10 Runtime error 39 ms 53956 KB Execution killed because of forbidden syscall writev (20)
11 Runtime error 49 ms 47812 KB Execution killed because of forbidden syscall writev (20)
12 Runtime error 46 ms 53956 KB Execution killed because of forbidden syscall writev (20)
13 Runtime error 36 ms 47812 KB Execution killed because of forbidden syscall writev (20)
14 Runtime error 66 ms 66244 KB Execution killed because of forbidden syscall writev (20)
15 Runtime error 29 ms 53956 KB Execution killed because of forbidden syscall writev (20)
16 Runtime error 56 ms 53956 KB Execution killed because of forbidden syscall writev (20)
17 Runtime error 46 ms 53956 KB Execution killed because of forbidden syscall writev (20)
18 Runtime error 56 ms 53956 KB Execution killed because of forbidden syscall writev (20)
19 Runtime error 33 ms 43204 KB Execution killed because of forbidden syscall writev (20)
20 Runtime error 59 ms 53956 KB Execution killed because of forbidden syscall writev (20)
21 Runtime error 53 ms 53956 KB Execution killed because of forbidden syscall writev (20)
22 Runtime error 73 ms 53956 KB Execution killed because of forbidden syscall writev (20)
23 Runtime error 43 ms 47812 KB Execution killed because of forbidden syscall writev (20)
24 Runtime error 33 ms 43204 KB Execution killed because of forbidden syscall writev (20)
25 Runtime error 33 ms 53956 KB Execution killed because of forbidden syscall writev (20)
26 Runtime error 59 ms 47812 KB Execution killed because of forbidden syscall writev (20)
27 Runtime error 59 ms 53956 KB Execution killed because of forbidden syscall writev (20)
28 Runtime error 33 ms 42436 KB Execution killed because of forbidden syscall writev (20)
29 Runtime error 53 ms 53956 KB Execution killed because of forbidden syscall writev (20)
30 Runtime error 53 ms 53956 KB Execution killed because of forbidden syscall writev (20)
31 Runtime error 33 ms 44740 KB Execution killed because of forbidden syscall writev (20)
32 Runtime error 36 ms 47812 KB Execution killed because of forbidden syscall writev (20)
33 Runtime error 16 ms 42436 KB Execution killed because of forbidden syscall writev (20)
34 Runtime error 53 ms 47812 KB Execution killed because of forbidden syscall writev (20)
35 Runtime error 23 ms 43204 KB Execution killed because of forbidden syscall writev (20)
36 Runtime error 46 ms 53956 KB Execution killed because of forbidden syscall writev (20)
37 Runtime error 43 ms 47812 KB Execution killed because of forbidden syscall writev (20)
38 Runtime error 43 ms 53956 KB Execution killed because of forbidden syscall writev (20)
39 Runtime error 29 ms 44740 KB Execution killed because of forbidden syscall writev (20)
40 Runtime error 46 ms 47812 KB Execution killed because of forbidden syscall writev (20)
41 Runtime error 29 ms 44740 KB Execution killed because of forbidden syscall writev (20)
42 Runtime error 29 ms 53956 KB Execution killed because of forbidden syscall writev (20)