# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
91411 | 2018-12-27T11:46:54 Z | davitmarg | Bootfall (IZhO17_bootfall) | C++17 | 1000 ms | 30676 KB |
/* DEATH-MATCH Davit-Marg */ #include <iostream> #include <algorithm> #include <cmath> #include <vector> #include <string> #include <cstring> #include <map> #include <set> #include <queue> #include <deque> #include <stack> #include <iterator> #include <ctype.h> #include <stdlib.h> #include <fstream> #define mod 1000000007ll #define LL long long #define LD long double #define MP make_pair #define PB push_back using namespace std; int n,a[502],dp[502][502*502],num[502 * 502]; int sum; vector<int> ans; int main() { cin >> n; for (int i = 0; i < n; i++) { cin >> a[i]; sum += a[i]; } for (int k = 0; k <= n; k++) { dp[k][0] = 1; for (int i = 0; i < n; i++) if(i!=k) for (int j = sum-a[k]; j >= 0; j--) dp[k][j + a[i]] += dp[k][j]; map<int, bool> used; if (k != n) for (int j = sum - a[k]-1; j >= 0; j--) { if (dp[k][j]==0 || used[abs(j - ((sum - a[k]) - j))]==1) continue; num[abs(j-((sum - a[k]) - j))]++; used[abs(j - ((sum - a[k]) - j))] = 1; } } if (sum % 2 || dp[n][sum / 2] == 0) { cout << 0 << endl; return 0; } for (int j = 0; j <= sum; j++) if (num[j] == n) ans.PB(j); cout << ans.size() << endl; for (int i = 0; i < ans.size(); i++) cout << ans[i] << " "; cout << endl; return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 504 KB | Output is correct |
3 | Correct | 2 ms | 504 KB | Output is correct |
4 | Correct | 2 ms | 528 KB | Output is correct |
5 | Correct | 3 ms | 676 KB | Output is correct |
6 | Correct | 2 ms | 676 KB | Output is correct |
7 | Correct | 2 ms | 676 KB | Output is correct |
8 | Correct | 2 ms | 744 KB | Output is correct |
9 | Correct | 2 ms | 744 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 504 KB | Output is correct |
3 | Correct | 2 ms | 504 KB | Output is correct |
4 | Correct | 2 ms | 528 KB | Output is correct |
5 | Correct | 3 ms | 676 KB | Output is correct |
6 | Correct | 2 ms | 676 KB | Output is correct |
7 | Correct | 2 ms | 676 KB | Output is correct |
8 | Correct | 2 ms | 744 KB | Output is correct |
9 | Correct | 2 ms | 744 KB | Output is correct |
10 | Correct | 2 ms | 928 KB | Output is correct |
11 | Correct | 2 ms | 928 KB | Output is correct |
12 | Correct | 2 ms | 928 KB | Output is correct |
13 | Correct | 2 ms | 928 KB | Output is correct |
14 | Correct | 2 ms | 928 KB | Output is correct |
15 | Correct | 2 ms | 928 KB | Output is correct |
16 | Correct | 2 ms | 928 KB | Output is correct |
17 | Correct | 2 ms | 928 KB | Output is correct |
18 | Correct | 2 ms | 928 KB | Output is correct |
19 | Correct | 2 ms | 928 KB | Output is correct |
20 | Correct | 2 ms | 960 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 504 KB | Output is correct |
3 | Correct | 2 ms | 504 KB | Output is correct |
4 | Correct | 2 ms | 528 KB | Output is correct |
5 | Correct | 3 ms | 676 KB | Output is correct |
6 | Correct | 2 ms | 676 KB | Output is correct |
7 | Correct | 2 ms | 676 KB | Output is correct |
8 | Correct | 2 ms | 744 KB | Output is correct |
9 | Correct | 2 ms | 744 KB | Output is correct |
10 | Correct | 2 ms | 928 KB | Output is correct |
11 | Correct | 2 ms | 928 KB | Output is correct |
12 | Correct | 2 ms | 928 KB | Output is correct |
13 | Correct | 2 ms | 928 KB | Output is correct |
14 | Correct | 2 ms | 928 KB | Output is correct |
15 | Correct | 2 ms | 928 KB | Output is correct |
16 | Correct | 2 ms | 928 KB | Output is correct |
17 | Correct | 2 ms | 928 KB | Output is correct |
18 | Correct | 2 ms | 928 KB | Output is correct |
19 | Correct | 2 ms | 928 KB | Output is correct |
20 | Correct | 2 ms | 960 KB | Output is correct |
21 | Correct | 22 ms | 1988 KB | Output is correct |
22 | Correct | 29 ms | 2252 KB | Output is correct |
23 | Correct | 13 ms | 2252 KB | Output is correct |
24 | Correct | 54 ms | 3056 KB | Output is correct |
25 | Correct | 92 ms | 4780 KB | Output is correct |
26 | Correct | 112 ms | 5248 KB | Output is correct |
27 | Correct | 77 ms | 5248 KB | Output is correct |
28 | Correct | 77 ms | 5248 KB | Output is correct |
29 | Correct | 96 ms | 5324 KB | Output is correct |
30 | Correct | 66 ms | 5324 KB | Output is correct |
31 | Correct | 97 ms | 5324 KB | Output is correct |
32 | Correct | 61 ms | 5324 KB | Output is correct |
33 | Correct | 57 ms | 5324 KB | Output is correct |
34 | Correct | 57 ms | 5360 KB | Output is correct |
35 | Correct | 82 ms | 5360 KB | Output is correct |
36 | Correct | 59 ms | 5360 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 504 KB | Output is correct |
3 | Correct | 2 ms | 504 KB | Output is correct |
4 | Correct | 2 ms | 528 KB | Output is correct |
5 | Correct | 3 ms | 676 KB | Output is correct |
6 | Correct | 2 ms | 676 KB | Output is correct |
7 | Correct | 2 ms | 676 KB | Output is correct |
8 | Correct | 2 ms | 744 KB | Output is correct |
9 | Correct | 2 ms | 744 KB | Output is correct |
10 | Correct | 2 ms | 928 KB | Output is correct |
11 | Correct | 2 ms | 928 KB | Output is correct |
12 | Correct | 2 ms | 928 KB | Output is correct |
13 | Correct | 2 ms | 928 KB | Output is correct |
14 | Correct | 2 ms | 928 KB | Output is correct |
15 | Correct | 2 ms | 928 KB | Output is correct |
16 | Correct | 2 ms | 928 KB | Output is correct |
17 | Correct | 2 ms | 928 KB | Output is correct |
18 | Correct | 2 ms | 928 KB | Output is correct |
19 | Correct | 2 ms | 928 KB | Output is correct |
20 | Correct | 2 ms | 960 KB | Output is correct |
21 | Correct | 22 ms | 1988 KB | Output is correct |
22 | Correct | 29 ms | 2252 KB | Output is correct |
23 | Correct | 13 ms | 2252 KB | Output is correct |
24 | Correct | 54 ms | 3056 KB | Output is correct |
25 | Correct | 92 ms | 4780 KB | Output is correct |
26 | Correct | 112 ms | 5248 KB | Output is correct |
27 | Correct | 77 ms | 5248 KB | Output is correct |
28 | Correct | 77 ms | 5248 KB | Output is correct |
29 | Correct | 96 ms | 5324 KB | Output is correct |
30 | Correct | 66 ms | 5324 KB | Output is correct |
31 | Correct | 97 ms | 5324 KB | Output is correct |
32 | Correct | 61 ms | 5324 KB | Output is correct |
33 | Correct | 57 ms | 5324 KB | Output is correct |
34 | Correct | 57 ms | 5360 KB | Output is correct |
35 | Correct | 82 ms | 5360 KB | Output is correct |
36 | Correct | 59 ms | 5360 KB | Output is correct |
37 | Correct | 772 ms | 17844 KB | Output is correct |
38 | Correct | 821 ms | 18124 KB | Output is correct |
39 | Execution timed out | 1073 ms | 30676 KB | Time limit exceeded |
40 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 504 KB | Output is correct |
3 | Correct | 2 ms | 504 KB | Output is correct |
4 | Correct | 2 ms | 528 KB | Output is correct |
5 | Correct | 3 ms | 676 KB | Output is correct |
6 | Correct | 2 ms | 676 KB | Output is correct |
7 | Correct | 2 ms | 676 KB | Output is correct |
8 | Correct | 2 ms | 744 KB | Output is correct |
9 | Correct | 2 ms | 744 KB | Output is correct |
10 | Correct | 2 ms | 928 KB | Output is correct |
11 | Correct | 2 ms | 928 KB | Output is correct |
12 | Correct | 2 ms | 928 KB | Output is correct |
13 | Correct | 2 ms | 928 KB | Output is correct |
14 | Correct | 2 ms | 928 KB | Output is correct |
15 | Correct | 2 ms | 928 KB | Output is correct |
16 | Correct | 2 ms | 928 KB | Output is correct |
17 | Correct | 2 ms | 928 KB | Output is correct |
18 | Correct | 2 ms | 928 KB | Output is correct |
19 | Correct | 2 ms | 928 KB | Output is correct |
20 | Correct | 2 ms | 960 KB | Output is correct |
21 | Correct | 22 ms | 1988 KB | Output is correct |
22 | Correct | 29 ms | 2252 KB | Output is correct |
23 | Correct | 13 ms | 2252 KB | Output is correct |
24 | Correct | 54 ms | 3056 KB | Output is correct |
25 | Correct | 92 ms | 4780 KB | Output is correct |
26 | Correct | 112 ms | 5248 KB | Output is correct |
27 | Correct | 77 ms | 5248 KB | Output is correct |
28 | Correct | 77 ms | 5248 KB | Output is correct |
29 | Correct | 96 ms | 5324 KB | Output is correct |
30 | Correct | 66 ms | 5324 KB | Output is correct |
31 | Correct | 97 ms | 5324 KB | Output is correct |
32 | Correct | 61 ms | 5324 KB | Output is correct |
33 | Correct | 57 ms | 5324 KB | Output is correct |
34 | Correct | 57 ms | 5360 KB | Output is correct |
35 | Correct | 82 ms | 5360 KB | Output is correct |
36 | Correct | 59 ms | 5360 KB | Output is correct |
37 | Correct | 772 ms | 17844 KB | Output is correct |
38 | Correct | 821 ms | 18124 KB | Output is correct |
39 | Execution timed out | 1073 ms | 30676 KB | Time limit exceeded |
40 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 504 KB | Output is correct |
3 | Correct | 2 ms | 504 KB | Output is correct |
4 | Correct | 2 ms | 528 KB | Output is correct |
5 | Correct | 3 ms | 676 KB | Output is correct |
6 | Correct | 2 ms | 676 KB | Output is correct |
7 | Correct | 2 ms | 676 KB | Output is correct |
8 | Correct | 2 ms | 744 KB | Output is correct |
9 | Correct | 2 ms | 744 KB | Output is correct |
10 | Correct | 2 ms | 928 KB | Output is correct |
11 | Correct | 2 ms | 928 KB | Output is correct |
12 | Correct | 2 ms | 928 KB | Output is correct |
13 | Correct | 2 ms | 928 KB | Output is correct |
14 | Correct | 2 ms | 928 KB | Output is correct |
15 | Correct | 2 ms | 928 KB | Output is correct |
16 | Correct | 2 ms | 928 KB | Output is correct |
17 | Correct | 2 ms | 928 KB | Output is correct |
18 | Correct | 2 ms | 928 KB | Output is correct |
19 | Correct | 2 ms | 928 KB | Output is correct |
20 | Correct | 2 ms | 960 KB | Output is correct |
21 | Correct | 22 ms | 1988 KB | Output is correct |
22 | Correct | 29 ms | 2252 KB | Output is correct |
23 | Correct | 13 ms | 2252 KB | Output is correct |
24 | Correct | 54 ms | 3056 KB | Output is correct |
25 | Correct | 92 ms | 4780 KB | Output is correct |
26 | Correct | 112 ms | 5248 KB | Output is correct |
27 | Correct | 77 ms | 5248 KB | Output is correct |
28 | Correct | 77 ms | 5248 KB | Output is correct |
29 | Correct | 96 ms | 5324 KB | Output is correct |
30 | Correct | 66 ms | 5324 KB | Output is correct |
31 | Correct | 97 ms | 5324 KB | Output is correct |
32 | Correct | 61 ms | 5324 KB | Output is correct |
33 | Correct | 57 ms | 5324 KB | Output is correct |
34 | Correct | 57 ms | 5360 KB | Output is correct |
35 | Correct | 82 ms | 5360 KB | Output is correct |
36 | Correct | 59 ms | 5360 KB | Output is correct |
37 | Correct | 772 ms | 17844 KB | Output is correct |
38 | Correct | 821 ms | 18124 KB | Output is correct |
39 | Execution timed out | 1073 ms | 30676 KB | Time limit exceeded |
40 | Halted | 0 ms | 0 KB | - |