답안 #63259

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
63259 2018-08-01T07:32:10 Z Tenuun Bootfall (IZhO17_bootfall) C++17
13 / 100
6 ms 2812 KB
#include<bits/stdc++.h>

using namespace std;

int sum=0;
int c[250000], res[250000];

void add(int t){
	sum+=t;
	for(int i=sum; i>=t; i--){
		c[i]+=c[i-t];
	}
}

void del(int t){
	sum-=t;
	for(int i=t; i<=sum; i++){
		c[i]-=c[i-t];
	}
}

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

Compilation message

bootfall.cpp: In function 'int main()':
bootfall.cpp:49:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i=0; i<ans.size(); i++) cout << ans[i] << " ";
               ~^~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 2296 KB Output is correct
2 Correct 4 ms 2416 KB Output is correct
3 Correct 5 ms 2416 KB Output is correct
4 Correct 4 ms 2476 KB Output is correct
5 Correct 4 ms 2476 KB Output is correct
6 Correct 4 ms 2516 KB Output is correct
7 Correct 5 ms 2520 KB Output is correct
8 Correct 5 ms 2520 KB Output is correct
9 Correct 5 ms 2540 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 2296 KB Output is correct
2 Correct 4 ms 2416 KB Output is correct
3 Correct 5 ms 2416 KB Output is correct
4 Correct 4 ms 2476 KB Output is correct
5 Correct 4 ms 2476 KB Output is correct
6 Correct 4 ms 2516 KB Output is correct
7 Correct 5 ms 2520 KB Output is correct
8 Correct 5 ms 2520 KB Output is correct
9 Correct 5 ms 2540 KB Output is correct
10 Correct 5 ms 2588 KB Output is correct
11 Correct 4 ms 2588 KB Output is correct
12 Correct 6 ms 2588 KB Output is correct
13 Correct 4 ms 2588 KB Output is correct
14 Correct 6 ms 2588 KB Output is correct
15 Correct 4 ms 2588 KB Output is correct
16 Correct 4 ms 2588 KB Output is correct
17 Correct 6 ms 2588 KB Output is correct
18 Correct 5 ms 2588 KB Output is correct
19 Correct 4 ms 2588 KB Output is correct
20 Correct 4 ms 2592 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 2296 KB Output is correct
2 Correct 4 ms 2416 KB Output is correct
3 Correct 5 ms 2416 KB Output is correct
4 Correct 4 ms 2476 KB Output is correct
5 Correct 4 ms 2476 KB Output is correct
6 Correct 4 ms 2516 KB Output is correct
7 Correct 5 ms 2520 KB Output is correct
8 Correct 5 ms 2520 KB Output is correct
9 Correct 5 ms 2540 KB Output is correct
10 Correct 5 ms 2588 KB Output is correct
11 Correct 4 ms 2588 KB Output is correct
12 Correct 6 ms 2588 KB Output is correct
13 Correct 4 ms 2588 KB Output is correct
14 Correct 6 ms 2588 KB Output is correct
15 Correct 4 ms 2588 KB Output is correct
16 Correct 4 ms 2588 KB Output is correct
17 Correct 6 ms 2588 KB Output is correct
18 Correct 5 ms 2588 KB Output is correct
19 Correct 4 ms 2588 KB Output is correct
20 Correct 4 ms 2592 KB Output is correct
21 Correct 6 ms 2620 KB Output is correct
22 Correct 6 ms 2620 KB Output is correct
23 Incorrect 5 ms 2812 KB Output isn't correct
24 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 2296 KB Output is correct
2 Correct 4 ms 2416 KB Output is correct
3 Correct 5 ms 2416 KB Output is correct
4 Correct 4 ms 2476 KB Output is correct
5 Correct 4 ms 2476 KB Output is correct
6 Correct 4 ms 2516 KB Output is correct
7 Correct 5 ms 2520 KB Output is correct
8 Correct 5 ms 2520 KB Output is correct
9 Correct 5 ms 2540 KB Output is correct
10 Correct 5 ms 2588 KB Output is correct
11 Correct 4 ms 2588 KB Output is correct
12 Correct 6 ms 2588 KB Output is correct
13 Correct 4 ms 2588 KB Output is correct
14 Correct 6 ms 2588 KB Output is correct
15 Correct 4 ms 2588 KB Output is correct
16 Correct 4 ms 2588 KB Output is correct
17 Correct 6 ms 2588 KB Output is correct
18 Correct 5 ms 2588 KB Output is correct
19 Correct 4 ms 2588 KB Output is correct
20 Correct 4 ms 2592 KB Output is correct
21 Correct 6 ms 2620 KB Output is correct
22 Correct 6 ms 2620 KB Output is correct
23 Incorrect 5 ms 2812 KB Output isn't correct
24 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 2296 KB Output is correct
2 Correct 4 ms 2416 KB Output is correct
3 Correct 5 ms 2416 KB Output is correct
4 Correct 4 ms 2476 KB Output is correct
5 Correct 4 ms 2476 KB Output is correct
6 Correct 4 ms 2516 KB Output is correct
7 Correct 5 ms 2520 KB Output is correct
8 Correct 5 ms 2520 KB Output is correct
9 Correct 5 ms 2540 KB Output is correct
10 Correct 5 ms 2588 KB Output is correct
11 Correct 4 ms 2588 KB Output is correct
12 Correct 6 ms 2588 KB Output is correct
13 Correct 4 ms 2588 KB Output is correct
14 Correct 6 ms 2588 KB Output is correct
15 Correct 4 ms 2588 KB Output is correct
16 Correct 4 ms 2588 KB Output is correct
17 Correct 6 ms 2588 KB Output is correct
18 Correct 5 ms 2588 KB Output is correct
19 Correct 4 ms 2588 KB Output is correct
20 Correct 4 ms 2592 KB Output is correct
21 Correct 6 ms 2620 KB Output is correct
22 Correct 6 ms 2620 KB Output is correct
23 Incorrect 5 ms 2812 KB Output isn't correct
24 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 2296 KB Output is correct
2 Correct 4 ms 2416 KB Output is correct
3 Correct 5 ms 2416 KB Output is correct
4 Correct 4 ms 2476 KB Output is correct
5 Correct 4 ms 2476 KB Output is correct
6 Correct 4 ms 2516 KB Output is correct
7 Correct 5 ms 2520 KB Output is correct
8 Correct 5 ms 2520 KB Output is correct
9 Correct 5 ms 2540 KB Output is correct
10 Correct 5 ms 2588 KB Output is correct
11 Correct 4 ms 2588 KB Output is correct
12 Correct 6 ms 2588 KB Output is correct
13 Correct 4 ms 2588 KB Output is correct
14 Correct 6 ms 2588 KB Output is correct
15 Correct 4 ms 2588 KB Output is correct
16 Correct 4 ms 2588 KB Output is correct
17 Correct 6 ms 2588 KB Output is correct
18 Correct 5 ms 2588 KB Output is correct
19 Correct 4 ms 2588 KB Output is correct
20 Correct 4 ms 2592 KB Output is correct
21 Correct 6 ms 2620 KB Output is correct
22 Correct 6 ms 2620 KB Output is correct
23 Incorrect 5 ms 2812 KB Output isn't correct
24 Halted 0 ms 0 KB -