Submission #1084215

# Submission time Handle Problem Language Result Execution time Memory
1084215 2024-09-05T16:10:05 Z elotelo966 Bootfall (IZhO17_bootfall) C++17
100 / 100
359 ms 5840 KB
#include <bits/stdc++.h>
using namespace std;
 
#define int long long
#define OYY LLONG_MAX
#define mod 998244353
#define faster ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define FOR for(int i=1;i<=n;i++)
#define mid (start+end)/2
#define lim 250005
#define fi first
#define se second

int dp[lim];

int cev[lim];

int sum;

int32_t main(){
	faster
	int n;cin>>n;
	int dizi[n];
	FOR{
		cin>>dizi[i];
		sum+=dizi[i];
	}
	
	dp[0]=1;
	
	FOR{
		for(int j=sum;j>=dizi[i];j--){
			dp[j]+=dp[j-dizi[i]];
		}
	}
	
	if(sum&1 || dp[sum/2]==0){
		cout<<0<<'\n';
		return 0;
	}
	
	FOR{
		for(int j=dizi[i];j<=sum;j++){
			dp[j]-=dp[j-dizi[i]];
		}
		for(int j=1;j<=sum;j++){
			int cur_sum=sum-dizi[i]+j;
			if(cur_sum%2==0 && dp[cur_sum/2])cev[j]++;
		}
		for(int j=sum;j>=dizi[i];j--){
			dp[j]+=dp[j-dizi[i]];
		}
	}
	
	vector<int> cevv;
	
	for(int i=1;i<=sum;i++){
		if(cev[i]==n)cevv.push_back(i);
	}
	
	cout<<cevv.size()<<'\n';
	
	for(auto x:cevv){
		cout<<x<<" ";
	}
	
	cout<<'\n';
	
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 468 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 468 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 416 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 1 ms 348 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
19 Correct 1 ms 348 KB Output is correct
20 Correct 1 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 468 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 416 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 1 ms 348 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
19 Correct 1 ms 348 KB Output is correct
20 Correct 1 ms 348 KB Output is correct
21 Correct 1 ms 468 KB Output is correct
22 Correct 1 ms 348 KB Output is correct
23 Correct 1 ms 348 KB Output is correct
24 Correct 2 ms 604 KB Output is correct
25 Correct 2 ms 600 KB Output is correct
26 Correct 3 ms 604 KB Output is correct
27 Correct 3 ms 616 KB Output is correct
28 Correct 3 ms 472 KB Output is correct
29 Correct 3 ms 604 KB Output is correct
30 Correct 2 ms 348 KB Output is correct
31 Correct 3 ms 604 KB Output is correct
32 Correct 2 ms 604 KB Output is correct
33 Correct 3 ms 604 KB Output is correct
34 Correct 3 ms 604 KB Output is correct
35 Correct 2 ms 604 KB Output is correct
36 Correct 2 ms 604 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 468 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 416 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 1 ms 348 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
19 Correct 1 ms 348 KB Output is correct
20 Correct 1 ms 348 KB Output is correct
21 Correct 1 ms 468 KB Output is correct
22 Correct 1 ms 348 KB Output is correct
23 Correct 1 ms 348 KB Output is correct
24 Correct 2 ms 604 KB Output is correct
25 Correct 2 ms 600 KB Output is correct
26 Correct 3 ms 604 KB Output is correct
27 Correct 3 ms 616 KB Output is correct
28 Correct 3 ms 472 KB Output is correct
29 Correct 3 ms 604 KB Output is correct
30 Correct 2 ms 348 KB Output is correct
31 Correct 3 ms 604 KB Output is correct
32 Correct 2 ms 604 KB Output is correct
33 Correct 3 ms 604 KB Output is correct
34 Correct 3 ms 604 KB Output is correct
35 Correct 2 ms 604 KB Output is correct
36 Correct 2 ms 604 KB Output is correct
37 Correct 10 ms 860 KB Output is correct
38 Correct 10 ms 860 KB Output is correct
39 Correct 41 ms 1372 KB Output is correct
40 Correct 22 ms 1116 KB Output is correct
41 Correct 47 ms 1372 KB Output is correct
42 Correct 28 ms 1116 KB Output is correct
43 Correct 34 ms 1724 KB Output is correct
44 Correct 47 ms 1752 KB Output is correct
45 Correct 36 ms 1744 KB Output is correct
46 Correct 20 ms 856 KB Output is correct
47 Correct 20 ms 1116 KB Output is correct
48 Correct 48 ms 1800 KB Output is correct
49 Correct 35 ms 1368 KB Output is correct
50 Correct 20 ms 1236 KB Output is correct
51 Correct 4 ms 604 KB Output is correct
52 Correct 52 ms 2056 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 468 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 416 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 1 ms 348 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
19 Correct 1 ms 348 KB Output is correct
20 Correct 1 ms 348 KB Output is correct
21 Correct 1 ms 468 KB Output is correct
22 Correct 1 ms 348 KB Output is correct
23 Correct 1 ms 348 KB Output is correct
24 Correct 2 ms 604 KB Output is correct
25 Correct 2 ms 600 KB Output is correct
26 Correct 3 ms 604 KB Output is correct
27 Correct 3 ms 616 KB Output is correct
28 Correct 3 ms 472 KB Output is correct
29 Correct 3 ms 604 KB Output is correct
30 Correct 2 ms 348 KB Output is correct
31 Correct 3 ms 604 KB Output is correct
32 Correct 2 ms 604 KB Output is correct
33 Correct 3 ms 604 KB Output is correct
34 Correct 3 ms 604 KB Output is correct
35 Correct 2 ms 604 KB Output is correct
36 Correct 2 ms 604 KB Output is correct
37 Correct 10 ms 860 KB Output is correct
38 Correct 10 ms 860 KB Output is correct
39 Correct 41 ms 1372 KB Output is correct
40 Correct 22 ms 1116 KB Output is correct
41 Correct 47 ms 1372 KB Output is correct
42 Correct 28 ms 1116 KB Output is correct
43 Correct 34 ms 1724 KB Output is correct
44 Correct 47 ms 1752 KB Output is correct
45 Correct 36 ms 1744 KB Output is correct
46 Correct 20 ms 856 KB Output is correct
47 Correct 20 ms 1116 KB Output is correct
48 Correct 48 ms 1800 KB Output is correct
49 Correct 35 ms 1368 KB Output is correct
50 Correct 20 ms 1236 KB Output is correct
51 Correct 4 ms 604 KB Output is correct
52 Correct 52 ms 2056 KB Output is correct
53 Correct 31 ms 1500 KB Output is correct
54 Correct 46 ms 1752 KB Output is correct
55 Correct 96 ms 2828 KB Output is correct
56 Correct 50 ms 1752 KB Output is correct
57 Correct 117 ms 3052 KB Output is correct
58 Correct 53 ms 1752 KB Output is correct
59 Correct 82 ms 2264 KB Output is correct
60 Correct 10 ms 856 KB Output is correct
61 Correct 101 ms 2516 KB Output is correct
62 Correct 94 ms 2516 KB Output is correct
63 Correct 102 ms 2696 KB Output is correct
64 Correct 89 ms 2772 KB Output is correct
65 Correct 38 ms 1216 KB Output is correct
66 Correct 40 ms 1360 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 468 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 416 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 1 ms 348 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
19 Correct 1 ms 348 KB Output is correct
20 Correct 1 ms 348 KB Output is correct
21 Correct 1 ms 468 KB Output is correct
22 Correct 1 ms 348 KB Output is correct
23 Correct 1 ms 348 KB Output is correct
24 Correct 2 ms 604 KB Output is correct
25 Correct 2 ms 600 KB Output is correct
26 Correct 3 ms 604 KB Output is correct
27 Correct 3 ms 616 KB Output is correct
28 Correct 3 ms 472 KB Output is correct
29 Correct 3 ms 604 KB Output is correct
30 Correct 2 ms 348 KB Output is correct
31 Correct 3 ms 604 KB Output is correct
32 Correct 2 ms 604 KB Output is correct
33 Correct 3 ms 604 KB Output is correct
34 Correct 3 ms 604 KB Output is correct
35 Correct 2 ms 604 KB Output is correct
36 Correct 2 ms 604 KB Output is correct
37 Correct 10 ms 860 KB Output is correct
38 Correct 10 ms 860 KB Output is correct
39 Correct 41 ms 1372 KB Output is correct
40 Correct 22 ms 1116 KB Output is correct
41 Correct 47 ms 1372 KB Output is correct
42 Correct 28 ms 1116 KB Output is correct
43 Correct 34 ms 1724 KB Output is correct
44 Correct 47 ms 1752 KB Output is correct
45 Correct 36 ms 1744 KB Output is correct
46 Correct 20 ms 856 KB Output is correct
47 Correct 20 ms 1116 KB Output is correct
48 Correct 48 ms 1800 KB Output is correct
49 Correct 35 ms 1368 KB Output is correct
50 Correct 20 ms 1236 KB Output is correct
51 Correct 4 ms 604 KB Output is correct
52 Correct 52 ms 2056 KB Output is correct
53 Correct 31 ms 1500 KB Output is correct
54 Correct 46 ms 1752 KB Output is correct
55 Correct 96 ms 2828 KB Output is correct
56 Correct 50 ms 1752 KB Output is correct
57 Correct 117 ms 3052 KB Output is correct
58 Correct 53 ms 1752 KB Output is correct
59 Correct 82 ms 2264 KB Output is correct
60 Correct 10 ms 856 KB Output is correct
61 Correct 101 ms 2516 KB Output is correct
62 Correct 94 ms 2516 KB Output is correct
63 Correct 102 ms 2696 KB Output is correct
64 Correct 89 ms 2772 KB Output is correct
65 Correct 38 ms 1216 KB Output is correct
66 Correct 40 ms 1360 KB Output is correct
67 Correct 117 ms 2260 KB Output is correct
68 Correct 25 ms 1436 KB Output is correct
69 Correct 258 ms 5316 KB Output is correct
70 Correct 191 ms 3284 KB Output is correct
71 Correct 156 ms 3360 KB Output is correct
72 Correct 183 ms 2408 KB Output is correct
73 Correct 149 ms 2388 KB Output is correct
74 Correct 267 ms 5580 KB Output is correct
75 Correct 199 ms 4304 KB Output is correct
76 Correct 325 ms 5840 KB Output is correct
77 Correct 359 ms 5772 KB Output is correct