# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
566683 | 2022-05-22T16:02:55 Z | Rifal | Bootfall (IZhO17_bootfall) | C++14 | 855 ms | 5508 KB |
#include <bits/stdc++.h> #include <fstream> #define endl '\n' #define mod 1668223877717 #define INF -100000000000000000 //#define ll long long //#define cin fin //#define cout fout using namespace std; //ofstream fout("convention.out"); //ifstream fin("convention.in"); const int M = 250005; long long dp[M]; long long cnt[M]; void add(long long x) { for(int i = M-1; i >= x; i--) { dp[i] += dp[i-x]%mod; dp[i] %= mod; } } void remo(long long x) { for(int i = x; i < M; i++) { dp[i] = ((dp[i]-dp[i-x])+mod)%mod; dp[i] %= mod; } } int main() { ios_base::sync_with_stdio(0);cout.tie(0);cin.tie(0); int n; cin >> n; long long arr[n]; long long sum = 0; dp[0] = 1; for(int i = 0; i < n; i++) { cin >> arr[i]; add(arr[i]); sum += arr[i]; } if(sum%2 == 1 || dp[sum/2] == 0) { cout << 0 << endl; return 0; } for(int i = 0; i < n; i++) { remo(arr[i]); sum -= arr[i]; for(long long j = 0; j <= sum/2; j++) { if(dp[j] >= 1) { if(sum-(j*2) != 0) cnt[sum-(j*2)]++; } } add(arr[i]); sum += arr[i]; } vector<int> ans; for(int i = 0; i < M; i++) { if(cnt[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
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 11 ms | 2260 KB | Output is correct |
2 | Correct | 13 ms | 2288 KB | Output is correct |
3 | Correct | 3 ms | 2260 KB | Output is correct |
4 | Correct | 9 ms | 2288 KB | Output is correct |
5 | Correct | 22 ms | 2284 KB | Output is correct |
6 | Correct | 15 ms | 2284 KB | Output is correct |
7 | Correct | 11 ms | 2260 KB | Output is correct |
8 | Correct | 20 ms | 2252 KB | Output is correct |
9 | Correct | 19 ms | 2284 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 11 ms | 2260 KB | Output is correct |
2 | Correct | 13 ms | 2288 KB | Output is correct |
3 | Correct | 3 ms | 2260 KB | Output is correct |
4 | Correct | 9 ms | 2288 KB | Output is correct |
5 | Correct | 22 ms | 2284 KB | Output is correct |
6 | Correct | 15 ms | 2284 KB | Output is correct |
7 | Correct | 11 ms | 2260 KB | Output is correct |
8 | Correct | 20 ms | 2252 KB | Output is correct |
9 | Correct | 19 ms | 2284 KB | Output is correct |
10 | Correct | 48 ms | 2284 KB | Output is correct |
11 | Correct | 53 ms | 2260 KB | Output is correct |
12 | Correct | 53 ms | 2264 KB | Output is correct |
13 | Correct | 45 ms | 2260 KB | Output is correct |
14 | Correct | 46 ms | 2272 KB | Output is correct |
15 | Correct | 57 ms | 2260 KB | Output is correct |
16 | Correct | 57 ms | 2264 KB | Output is correct |
17 | Correct | 31 ms | 2264 KB | Output is correct |
18 | Correct | 41 ms | 2260 KB | Output is correct |
19 | Correct | 45 ms | 2380 KB | Output is correct |
20 | Correct | 55 ms | 2284 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 11 ms | 2260 KB | Output is correct |
2 | Correct | 13 ms | 2288 KB | Output is correct |
3 | Correct | 3 ms | 2260 KB | Output is correct |
4 | Correct | 9 ms | 2288 KB | Output is correct |
5 | Correct | 22 ms | 2284 KB | Output is correct |
6 | Correct | 15 ms | 2284 KB | Output is correct |
7 | Correct | 11 ms | 2260 KB | Output is correct |
8 | Correct | 20 ms | 2252 KB | Output is correct |
9 | Correct | 19 ms | 2284 KB | Output is correct |
10 | Correct | 48 ms | 2284 KB | Output is correct |
11 | Correct | 53 ms | 2260 KB | Output is correct |
12 | Correct | 53 ms | 2264 KB | Output is correct |
13 | Correct | 45 ms | 2260 KB | Output is correct |
14 | Correct | 46 ms | 2272 KB | Output is correct |
15 | Correct | 57 ms | 2260 KB | Output is correct |
16 | Correct | 57 ms | 2264 KB | Output is correct |
17 | Correct | 31 ms | 2264 KB | Output is correct |
18 | Correct | 41 ms | 2260 KB | Output is correct |
19 | Correct | 45 ms | 2380 KB | Output is correct |
20 | Correct | 55 ms | 2284 KB | Output is correct |
21 | Correct | 111 ms | 2304 KB | Output is correct |
22 | Correct | 117 ms | 2400 KB | Output is correct |
23 | Correct | 82 ms | 2276 KB | Output is correct |
24 | Correct | 152 ms | 2260 KB | Output is correct |
25 | Correct | 144 ms | 2268 KB | Output is correct |
26 | Correct | 159 ms | 2384 KB | Output is correct |
27 | Correct | 157 ms | 2264 KB | Output is correct |
28 | Correct | 154 ms | 2336 KB | Output is correct |
29 | Correct | 157 ms | 2352 KB | Output is correct |
30 | Correct | 156 ms | 2304 KB | Output is correct |
31 | Correct | 160 ms | 2316 KB | Output is correct |
32 | Correct | 156 ms | 2300 KB | Output is correct |
33 | Correct | 155 ms | 2272 KB | Output is correct |
34 | Correct | 159 ms | 2260 KB | Output is correct |
35 | Correct | 153 ms | 2264 KB | Output is correct |
36 | Correct | 156 ms | 2260 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 11 ms | 2260 KB | Output is correct |
2 | Correct | 13 ms | 2288 KB | Output is correct |
3 | Correct | 3 ms | 2260 KB | Output is correct |
4 | Correct | 9 ms | 2288 KB | Output is correct |
5 | Correct | 22 ms | 2284 KB | Output is correct |
6 | Correct | 15 ms | 2284 KB | Output is correct |
7 | Correct | 11 ms | 2260 KB | Output is correct |
8 | Correct | 20 ms | 2252 KB | Output is correct |
9 | Correct | 19 ms | 2284 KB | Output is correct |
10 | Correct | 48 ms | 2284 KB | Output is correct |
11 | Correct | 53 ms | 2260 KB | Output is correct |
12 | Correct | 53 ms | 2264 KB | Output is correct |
13 | Correct | 45 ms | 2260 KB | Output is correct |
14 | Correct | 46 ms | 2272 KB | Output is correct |
15 | Correct | 57 ms | 2260 KB | Output is correct |
16 | Correct | 57 ms | 2264 KB | Output is correct |
17 | Correct | 31 ms | 2264 KB | Output is correct |
18 | Correct | 41 ms | 2260 KB | Output is correct |
19 | Correct | 45 ms | 2380 KB | Output is correct |
20 | Correct | 55 ms | 2284 KB | Output is correct |
21 | Correct | 111 ms | 2304 KB | Output is correct |
22 | Correct | 117 ms | 2400 KB | Output is correct |
23 | Correct | 82 ms | 2276 KB | Output is correct |
24 | Correct | 152 ms | 2260 KB | Output is correct |
25 | Correct | 144 ms | 2268 KB | Output is correct |
26 | Correct | 159 ms | 2384 KB | Output is correct |
27 | Correct | 157 ms | 2264 KB | Output is correct |
28 | Correct | 154 ms | 2336 KB | Output is correct |
29 | Correct | 157 ms | 2352 KB | Output is correct |
30 | Correct | 156 ms | 2304 KB | Output is correct |
31 | Correct | 160 ms | 2316 KB | Output is correct |
32 | Correct | 156 ms | 2300 KB | Output is correct |
33 | Correct | 155 ms | 2272 KB | Output is correct |
34 | Correct | 159 ms | 2260 KB | Output is correct |
35 | Correct | 153 ms | 2264 KB | Output is correct |
36 | Correct | 156 ms | 2260 KB | Output is correct |
37 | Correct | 306 ms | 2528 KB | Output is correct |
38 | Correct | 321 ms | 2664 KB | Output is correct |
39 | Correct | 383 ms | 2660 KB | Output is correct |
40 | Correct | 432 ms | 2648 KB | Output is correct |
41 | Correct | 422 ms | 2800 KB | Output is correct |
42 | Correct | 410 ms | 2624 KB | Output is correct |
43 | Correct | 376 ms | 3076 KB | Output is correct |
44 | Correct | 402 ms | 3084 KB | Output is correct |
45 | Correct | 397 ms | 3084 KB | Output is correct |
46 | Correct | 419 ms | 2516 KB | Output is correct |
47 | Correct | 396 ms | 2648 KB | Output is correct |
48 | Correct | 403 ms | 3000 KB | Output is correct |
49 | Correct | 425 ms | 2744 KB | Output is correct |
50 | Correct | 393 ms | 2664 KB | Output is correct |
51 | Correct | 145 ms | 2264 KB | Output is correct |
52 | Correct | 452 ms | 3188 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 11 ms | 2260 KB | Output is correct |
2 | Correct | 13 ms | 2288 KB | Output is correct |
3 | Correct | 3 ms | 2260 KB | Output is correct |
4 | Correct | 9 ms | 2288 KB | Output is correct |
5 | Correct | 22 ms | 2284 KB | Output is correct |
6 | Correct | 15 ms | 2284 KB | Output is correct |
7 | Correct | 11 ms | 2260 KB | Output is correct |
8 | Correct | 20 ms | 2252 KB | Output is correct |
9 | Correct | 19 ms | 2284 KB | Output is correct |
10 | Correct | 48 ms | 2284 KB | Output is correct |
11 | Correct | 53 ms | 2260 KB | Output is correct |
12 | Correct | 53 ms | 2264 KB | Output is correct |
13 | Correct | 45 ms | 2260 KB | Output is correct |
14 | Correct | 46 ms | 2272 KB | Output is correct |
15 | Correct | 57 ms | 2260 KB | Output is correct |
16 | Correct | 57 ms | 2264 KB | Output is correct |
17 | Correct | 31 ms | 2264 KB | Output is correct |
18 | Correct | 41 ms | 2260 KB | Output is correct |
19 | Correct | 45 ms | 2380 KB | Output is correct |
20 | Correct | 55 ms | 2284 KB | Output is correct |
21 | Correct | 111 ms | 2304 KB | Output is correct |
22 | Correct | 117 ms | 2400 KB | Output is correct |
23 | Correct | 82 ms | 2276 KB | Output is correct |
24 | Correct | 152 ms | 2260 KB | Output is correct |
25 | Correct | 144 ms | 2268 KB | Output is correct |
26 | Correct | 159 ms | 2384 KB | Output is correct |
27 | Correct | 157 ms | 2264 KB | Output is correct |
28 | Correct | 154 ms | 2336 KB | Output is correct |
29 | Correct | 157 ms | 2352 KB | Output is correct |
30 | Correct | 156 ms | 2304 KB | Output is correct |
31 | Correct | 160 ms | 2316 KB | Output is correct |
32 | Correct | 156 ms | 2300 KB | Output is correct |
33 | Correct | 155 ms | 2272 KB | Output is correct |
34 | Correct | 159 ms | 2260 KB | Output is correct |
35 | Correct | 153 ms | 2264 KB | Output is correct |
36 | Correct | 156 ms | 2260 KB | Output is correct |
37 | Correct | 306 ms | 2528 KB | Output is correct |
38 | Correct | 321 ms | 2664 KB | Output is correct |
39 | Correct | 383 ms | 2660 KB | Output is correct |
40 | Correct | 432 ms | 2648 KB | Output is correct |
41 | Correct | 422 ms | 2800 KB | Output is correct |
42 | Correct | 410 ms | 2624 KB | Output is correct |
43 | Correct | 376 ms | 3076 KB | Output is correct |
44 | Correct | 402 ms | 3084 KB | Output is correct |
45 | Correct | 397 ms | 3084 KB | Output is correct |
46 | Correct | 419 ms | 2516 KB | Output is correct |
47 | Correct | 396 ms | 2648 KB | Output is correct |
48 | Correct | 403 ms | 3000 KB | Output is correct |
49 | Correct | 425 ms | 2744 KB | Output is correct |
50 | Correct | 393 ms | 2664 KB | Output is correct |
51 | Correct | 145 ms | 2264 KB | Output is correct |
52 | Correct | 452 ms | 3188 KB | Output is correct |
53 | Correct | 466 ms | 2872 KB | Output is correct |
54 | Correct | 538 ms | 3148 KB | Output is correct |
55 | Correct | 565 ms | 3640 KB | Output is correct |
56 | Correct | 478 ms | 3084 KB | Output is correct |
57 | Correct | 561 ms | 3928 KB | Output is correct |
58 | Correct | 577 ms | 3168 KB | Output is correct |
59 | Correct | 553 ms | 3312 KB | Output is correct |
60 | Correct | 201 ms | 2260 KB | Output is correct |
61 | Correct | 546 ms | 3448 KB | Output is correct |
62 | Correct | 514 ms | 3528 KB | Output is correct |
63 | Correct | 572 ms | 3676 KB | Output is correct |
64 | Correct | 504 ms | 3556 KB | Output is correct |
65 | Correct | 531 ms | 2664 KB | Output is correct |
66 | Correct | 490 ms | 2680 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 11 ms | 2260 KB | Output is correct |
2 | Correct | 13 ms | 2288 KB | Output is correct |
3 | Correct | 3 ms | 2260 KB | Output is correct |
4 | Correct | 9 ms | 2288 KB | Output is correct |
5 | Correct | 22 ms | 2284 KB | Output is correct |
6 | Correct | 15 ms | 2284 KB | Output is correct |
7 | Correct | 11 ms | 2260 KB | Output is correct |
8 | Correct | 20 ms | 2252 KB | Output is correct |
9 | Correct | 19 ms | 2284 KB | Output is correct |
10 | Correct | 48 ms | 2284 KB | Output is correct |
11 | Correct | 53 ms | 2260 KB | Output is correct |
12 | Correct | 53 ms | 2264 KB | Output is correct |
13 | Correct | 45 ms | 2260 KB | Output is correct |
14 | Correct | 46 ms | 2272 KB | Output is correct |
15 | Correct | 57 ms | 2260 KB | Output is correct |
16 | Correct | 57 ms | 2264 KB | Output is correct |
17 | Correct | 31 ms | 2264 KB | Output is correct |
18 | Correct | 41 ms | 2260 KB | Output is correct |
19 | Correct | 45 ms | 2380 KB | Output is correct |
20 | Correct | 55 ms | 2284 KB | Output is correct |
21 | Correct | 111 ms | 2304 KB | Output is correct |
22 | Correct | 117 ms | 2400 KB | Output is correct |
23 | Correct | 82 ms | 2276 KB | Output is correct |
24 | Correct | 152 ms | 2260 KB | Output is correct |
25 | Correct | 144 ms | 2268 KB | Output is correct |
26 | Correct | 159 ms | 2384 KB | Output is correct |
27 | Correct | 157 ms | 2264 KB | Output is correct |
28 | Correct | 154 ms | 2336 KB | Output is correct |
29 | Correct | 157 ms | 2352 KB | Output is correct |
30 | Correct | 156 ms | 2304 KB | Output is correct |
31 | Correct | 160 ms | 2316 KB | Output is correct |
32 | Correct | 156 ms | 2300 KB | Output is correct |
33 | Correct | 155 ms | 2272 KB | Output is correct |
34 | Correct | 159 ms | 2260 KB | Output is correct |
35 | Correct | 153 ms | 2264 KB | Output is correct |
36 | Correct | 156 ms | 2260 KB | Output is correct |
37 | Correct | 306 ms | 2528 KB | Output is correct |
38 | Correct | 321 ms | 2664 KB | Output is correct |
39 | Correct | 383 ms | 2660 KB | Output is correct |
40 | Correct | 432 ms | 2648 KB | Output is correct |
41 | Correct | 422 ms | 2800 KB | Output is correct |
42 | Correct | 410 ms | 2624 KB | Output is correct |
43 | Correct | 376 ms | 3076 KB | Output is correct |
44 | Correct | 402 ms | 3084 KB | Output is correct |
45 | Correct | 397 ms | 3084 KB | Output is correct |
46 | Correct | 419 ms | 2516 KB | Output is correct |
47 | Correct | 396 ms | 2648 KB | Output is correct |
48 | Correct | 403 ms | 3000 KB | Output is correct |
49 | Correct | 425 ms | 2744 KB | Output is correct |
50 | Correct | 393 ms | 2664 KB | Output is correct |
51 | Correct | 145 ms | 2264 KB | Output is correct |
52 | Correct | 452 ms | 3188 KB | Output is correct |
53 | Correct | 466 ms | 2872 KB | Output is correct |
54 | Correct | 538 ms | 3148 KB | Output is correct |
55 | Correct | 565 ms | 3640 KB | Output is correct |
56 | Correct | 478 ms | 3084 KB | Output is correct |
57 | Correct | 561 ms | 3928 KB | Output is correct |
58 | Correct | 577 ms | 3168 KB | Output is correct |
59 | Correct | 553 ms | 3312 KB | Output is correct |
60 | Correct | 201 ms | 2260 KB | Output is correct |
61 | Correct | 546 ms | 3448 KB | Output is correct |
62 | Correct | 514 ms | 3528 KB | Output is correct |
63 | Correct | 572 ms | 3676 KB | Output is correct |
64 | Correct | 504 ms | 3556 KB | Output is correct |
65 | Correct | 531 ms | 2664 KB | Output is correct |
66 | Correct | 490 ms | 2680 KB | Output is correct |
67 | Correct | 651 ms | 3404 KB | Output is correct |
68 | Correct | 286 ms | 2276 KB | Output is correct |
69 | Correct | 855 ms | 5064 KB | Output is correct |
70 | Correct | 827 ms | 4036 KB | Output is correct |
71 | Correct | 812 ms | 4068 KB | Output is correct |
72 | Correct | 812 ms | 3240 KB | Output is correct |
73 | Correct | 799 ms | 3236 KB | Output is correct |
74 | Correct | 840 ms | 5324 KB | Output is correct |
75 | Correct | 807 ms | 4568 KB | Output is correct |
76 | Correct | 815 ms | 5332 KB | Output is correct |
77 | Correct | 815 ms | 5508 KB | Output is correct |