답안 #62786

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
62786 2018-07-30T04:03:50 Z Tenuun Bootfall (IZhO17_bootfall) C++17
28 / 100
1000 ms 2452 KB
#include<bits/stdc++.h>
 
using namespace std;
 
int n, a[500], res[250001];

bool s[250001];

void check(){
	s[0]=true;
	vector<int> tmp;
	tmp.push_back(0);
	int sz;
	for(int i=0; i<n; i++){
		sz=tmp.size();
		for(int j=0; j<sz; j++){
			if(!s[tmp[j]+a[i]]){
				s[tmp[j]+a[i]]=true;
				tmp.push_back(tmp[j]+a[i]);
			}
		}
	}
}

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int tot=0;
	cin >> n;
	for(int i=0; i<n; i++){
		cin >> a[i];
		tot+=a[i];
	}
	memset(res, 0, sizeof res);
	memset(s, 0, sizeof s);
	check();
	if(tot%2 || !s[tot/2]){
		return cout << 0, 0;
	}
	int tmp;
	for(int i=0; i<n; i++){
		tmp=a[i];
		a[i]=0;
		memset(s, 0, sizeof s);
		check();
		tot-=tmp;
		for(int j=1; j<=tot; j++){
			if((tot+j)%2) continue;
			if(s[(tot+j)/2]){
				res[j]++;
			}
		}
		tot+=tmp;
		a[i]=tmp;
	}
	vector<int>res;
	for(int i=1; i<=tot; i++){
		if(::res[i]==n){
			res.push_back(i);
		}
	}
	cout << res.size() << endl;
	for(int i=0; i<res.size(); i++) cout << res[i] << " ";
	return 0;
}

Compilation message

bootfall.cpp: In function 'int main()':
bootfall.cpp:63:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i=0; i<res.size(); i++) cout << res[i] << " ";
               ~^~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 1656 KB Output is correct
2 Correct 4 ms 1656 KB Output is correct
3 Correct 4 ms 1836 KB Output is correct
4 Correct 4 ms 1836 KB Output is correct
5 Correct 4 ms 1836 KB Output is correct
6 Correct 4 ms 1836 KB Output is correct
7 Correct 4 ms 1836 KB Output is correct
8 Correct 5 ms 1836 KB Output is correct
9 Correct 4 ms 1836 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 1656 KB Output is correct
2 Correct 4 ms 1656 KB Output is correct
3 Correct 4 ms 1836 KB Output is correct
4 Correct 4 ms 1836 KB Output is correct
5 Correct 4 ms 1836 KB Output is correct
6 Correct 4 ms 1836 KB Output is correct
7 Correct 4 ms 1836 KB Output is correct
8 Correct 5 ms 1836 KB Output is correct
9 Correct 4 ms 1836 KB Output is correct
10 Correct 5 ms 1836 KB Output is correct
11 Correct 4 ms 1836 KB Output is correct
12 Correct 5 ms 1836 KB Output is correct
13 Correct 4 ms 1836 KB Output is correct
14 Correct 4 ms 1836 KB Output is correct
15 Correct 4 ms 1836 KB Output is correct
16 Correct 5 ms 1836 KB Output is correct
17 Correct 5 ms 1836 KB Output is correct
18 Correct 4 ms 1836 KB Output is correct
19 Correct 5 ms 1836 KB Output is correct
20 Correct 4 ms 1836 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 1656 KB Output is correct
2 Correct 4 ms 1656 KB Output is correct
3 Correct 4 ms 1836 KB Output is correct
4 Correct 4 ms 1836 KB Output is correct
5 Correct 4 ms 1836 KB Output is correct
6 Correct 4 ms 1836 KB Output is correct
7 Correct 4 ms 1836 KB Output is correct
8 Correct 5 ms 1836 KB Output is correct
9 Correct 4 ms 1836 KB Output is correct
10 Correct 5 ms 1836 KB Output is correct
11 Correct 4 ms 1836 KB Output is correct
12 Correct 5 ms 1836 KB Output is correct
13 Correct 4 ms 1836 KB Output is correct
14 Correct 4 ms 1836 KB Output is correct
15 Correct 4 ms 1836 KB Output is correct
16 Correct 5 ms 1836 KB Output is correct
17 Correct 5 ms 1836 KB Output is correct
18 Correct 4 ms 1836 KB Output is correct
19 Correct 5 ms 1836 KB Output is correct
20 Correct 4 ms 1836 KB Output is correct
21 Correct 14 ms 1836 KB Output is correct
22 Correct 23 ms 1868 KB Output is correct
23 Correct 9 ms 2012 KB Output is correct
24 Correct 38 ms 2012 KB Output is correct
25 Correct 61 ms 2012 KB Output is correct
26 Correct 53 ms 2012 KB Output is correct
27 Correct 36 ms 2012 KB Output is correct
28 Correct 28 ms 2012 KB Output is correct
29 Correct 37 ms 2040 KB Output is correct
30 Correct 56 ms 2040 KB Output is correct
31 Correct 76 ms 2092 KB Output is correct
32 Correct 44 ms 2096 KB Output is correct
33 Correct 7 ms 2096 KB Output is correct
34 Correct 5 ms 2096 KB Output is correct
35 Correct 37 ms 2096 KB Output is correct
36 Correct 40 ms 2096 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 1656 KB Output is correct
2 Correct 4 ms 1656 KB Output is correct
3 Correct 4 ms 1836 KB Output is correct
4 Correct 4 ms 1836 KB Output is correct
5 Correct 4 ms 1836 KB Output is correct
6 Correct 4 ms 1836 KB Output is correct
7 Correct 4 ms 1836 KB Output is correct
8 Correct 5 ms 1836 KB Output is correct
9 Correct 4 ms 1836 KB Output is correct
10 Correct 5 ms 1836 KB Output is correct
11 Correct 4 ms 1836 KB Output is correct
12 Correct 5 ms 1836 KB Output is correct
13 Correct 4 ms 1836 KB Output is correct
14 Correct 4 ms 1836 KB Output is correct
15 Correct 4 ms 1836 KB Output is correct
16 Correct 5 ms 1836 KB Output is correct
17 Correct 5 ms 1836 KB Output is correct
18 Correct 4 ms 1836 KB Output is correct
19 Correct 5 ms 1836 KB Output is correct
20 Correct 4 ms 1836 KB Output is correct
21 Correct 14 ms 1836 KB Output is correct
22 Correct 23 ms 1868 KB Output is correct
23 Correct 9 ms 2012 KB Output is correct
24 Correct 38 ms 2012 KB Output is correct
25 Correct 61 ms 2012 KB Output is correct
26 Correct 53 ms 2012 KB Output is correct
27 Correct 36 ms 2012 KB Output is correct
28 Correct 28 ms 2012 KB Output is correct
29 Correct 37 ms 2040 KB Output is correct
30 Correct 56 ms 2040 KB Output is correct
31 Correct 76 ms 2092 KB Output is correct
32 Correct 44 ms 2096 KB Output is correct
33 Correct 7 ms 2096 KB Output is correct
34 Correct 5 ms 2096 KB Output is correct
35 Correct 37 ms 2096 KB Output is correct
36 Correct 40 ms 2096 KB Output is correct
37 Correct 517 ms 2372 KB Output is correct
38 Correct 515 ms 2372 KB Output is correct
39 Correct 45 ms 2372 KB Output is correct
40 Execution timed out 1081 ms 2452 KB Time limit exceeded
41 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 1656 KB Output is correct
2 Correct 4 ms 1656 KB Output is correct
3 Correct 4 ms 1836 KB Output is correct
4 Correct 4 ms 1836 KB Output is correct
5 Correct 4 ms 1836 KB Output is correct
6 Correct 4 ms 1836 KB Output is correct
7 Correct 4 ms 1836 KB Output is correct
8 Correct 5 ms 1836 KB Output is correct
9 Correct 4 ms 1836 KB Output is correct
10 Correct 5 ms 1836 KB Output is correct
11 Correct 4 ms 1836 KB Output is correct
12 Correct 5 ms 1836 KB Output is correct
13 Correct 4 ms 1836 KB Output is correct
14 Correct 4 ms 1836 KB Output is correct
15 Correct 4 ms 1836 KB Output is correct
16 Correct 5 ms 1836 KB Output is correct
17 Correct 5 ms 1836 KB Output is correct
18 Correct 4 ms 1836 KB Output is correct
19 Correct 5 ms 1836 KB Output is correct
20 Correct 4 ms 1836 KB Output is correct
21 Correct 14 ms 1836 KB Output is correct
22 Correct 23 ms 1868 KB Output is correct
23 Correct 9 ms 2012 KB Output is correct
24 Correct 38 ms 2012 KB Output is correct
25 Correct 61 ms 2012 KB Output is correct
26 Correct 53 ms 2012 KB Output is correct
27 Correct 36 ms 2012 KB Output is correct
28 Correct 28 ms 2012 KB Output is correct
29 Correct 37 ms 2040 KB Output is correct
30 Correct 56 ms 2040 KB Output is correct
31 Correct 76 ms 2092 KB Output is correct
32 Correct 44 ms 2096 KB Output is correct
33 Correct 7 ms 2096 KB Output is correct
34 Correct 5 ms 2096 KB Output is correct
35 Correct 37 ms 2096 KB Output is correct
36 Correct 40 ms 2096 KB Output is correct
37 Correct 517 ms 2372 KB Output is correct
38 Correct 515 ms 2372 KB Output is correct
39 Correct 45 ms 2372 KB Output is correct
40 Execution timed out 1081 ms 2452 KB Time limit exceeded
41 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 1656 KB Output is correct
2 Correct 4 ms 1656 KB Output is correct
3 Correct 4 ms 1836 KB Output is correct
4 Correct 4 ms 1836 KB Output is correct
5 Correct 4 ms 1836 KB Output is correct
6 Correct 4 ms 1836 KB Output is correct
7 Correct 4 ms 1836 KB Output is correct
8 Correct 5 ms 1836 KB Output is correct
9 Correct 4 ms 1836 KB Output is correct
10 Correct 5 ms 1836 KB Output is correct
11 Correct 4 ms 1836 KB Output is correct
12 Correct 5 ms 1836 KB Output is correct
13 Correct 4 ms 1836 KB Output is correct
14 Correct 4 ms 1836 KB Output is correct
15 Correct 4 ms 1836 KB Output is correct
16 Correct 5 ms 1836 KB Output is correct
17 Correct 5 ms 1836 KB Output is correct
18 Correct 4 ms 1836 KB Output is correct
19 Correct 5 ms 1836 KB Output is correct
20 Correct 4 ms 1836 KB Output is correct
21 Correct 14 ms 1836 KB Output is correct
22 Correct 23 ms 1868 KB Output is correct
23 Correct 9 ms 2012 KB Output is correct
24 Correct 38 ms 2012 KB Output is correct
25 Correct 61 ms 2012 KB Output is correct
26 Correct 53 ms 2012 KB Output is correct
27 Correct 36 ms 2012 KB Output is correct
28 Correct 28 ms 2012 KB Output is correct
29 Correct 37 ms 2040 KB Output is correct
30 Correct 56 ms 2040 KB Output is correct
31 Correct 76 ms 2092 KB Output is correct
32 Correct 44 ms 2096 KB Output is correct
33 Correct 7 ms 2096 KB Output is correct
34 Correct 5 ms 2096 KB Output is correct
35 Correct 37 ms 2096 KB Output is correct
36 Correct 40 ms 2096 KB Output is correct
37 Correct 517 ms 2372 KB Output is correct
38 Correct 515 ms 2372 KB Output is correct
39 Correct 45 ms 2372 KB Output is correct
40 Execution timed out 1081 ms 2452 KB Time limit exceeded
41 Halted 0 ms 0 KB -