# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
169563 | 2019-12-21T05:37:28 Z | Gurban | Bootfall (IZhO17_bootfall) | C++14 | 1000 ms | 3448 KB |
#include <bits/stdc++.h> #define pb push_back #define ss second #define ff first #define N 250009 #define inf 1000000009 #define ll long long #define mid(a,b) (a+b)/2 using namespace std; int n,a[509],sum,dp[N],s; map <int,int> m; vector <int> v; const int mod = 1e9+7; int main() { scanf("%d",&n); for(int i = 1;i <= n;i++){ scanf("%d",&a[i]); sum += a[i]; } dp[0] = 1; for(int i = 1;i <= n;i++) for(int j = sum;j >= 0;j--) dp[j + a[i]] += dp[j]; if(sum % 2 == 1 or dp[sum / 2] == 0) return cout << 0,0; for(int i = 1;i <= n;i++){ for(int j = a[i];j <= sum;j++) dp[j] -= dp[j - a[i]]; for(int j = 1;j < sum;j++){ if(m[j] < i - 1) continue; s = sum - a[i] + j; if(s % 2 == 0 and s / 2 - j >= 0 and dp[s / 2 - j]) m[j]++; } for(int j = sum;j >= a[i];j--) dp[j] += dp[j - a[i]]; } for(auto i : m) if(i.ss == n) v.pb(i.ff); printf("%d\n",v.size()); for(auto i : v) printf("%d\n",i); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 256 KB | Output is correct |
4 | Correct | 2 ms | 376 KB | Output is correct |
5 | Correct | 3 ms | 376 KB | Output is correct |
6 | Correct | 2 ms | 376 KB | Output is correct |
7 | Correct | 3 ms | 376 KB | Output is correct |
8 | Correct | 4 ms | 380 KB | Output is correct |
9 | Correct | 2 ms | 376 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 256 KB | Output is correct |
4 | Correct | 2 ms | 376 KB | Output is correct |
5 | Correct | 3 ms | 376 KB | Output is correct |
6 | Correct | 2 ms | 376 KB | Output is correct |
7 | Correct | 3 ms | 376 KB | Output is correct |
8 | Correct | 4 ms | 380 KB | Output is correct |
9 | Correct | 2 ms | 376 KB | Output is correct |
10 | Correct | 3 ms | 376 KB | Output is correct |
11 | Correct | 3 ms | 376 KB | Output is correct |
12 | Correct | 3 ms | 376 KB | Output is correct |
13 | Correct | 2 ms | 376 KB | Output is correct |
14 | Correct | 3 ms | 376 KB | Output is correct |
15 | Correct | 2 ms | 376 KB | Output is correct |
16 | Correct | 2 ms | 364 KB | Output is correct |
17 | Correct | 2 ms | 376 KB | Output is correct |
18 | Correct | 2 ms | 376 KB | Output is correct |
19 | Correct | 2 ms | 376 KB | Output is correct |
20 | Correct | 3 ms | 376 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 256 KB | Output is correct |
4 | Correct | 2 ms | 376 KB | Output is correct |
5 | Correct | 3 ms | 376 KB | Output is correct |
6 | Correct | 2 ms | 376 KB | Output is correct |
7 | Correct | 3 ms | 376 KB | Output is correct |
8 | Correct | 4 ms | 380 KB | Output is correct |
9 | Correct | 2 ms | 376 KB | Output is correct |
10 | Correct | 3 ms | 376 KB | Output is correct |
11 | Correct | 3 ms | 376 KB | Output is correct |
12 | Correct | 3 ms | 376 KB | Output is correct |
13 | Correct | 2 ms | 376 KB | Output is correct |
14 | Correct | 3 ms | 376 KB | Output is correct |
15 | Correct | 2 ms | 376 KB | Output is correct |
16 | Correct | 2 ms | 364 KB | Output is correct |
17 | Correct | 2 ms | 376 KB | Output is correct |
18 | Correct | 2 ms | 376 KB | Output is correct |
19 | Correct | 2 ms | 376 KB | Output is correct |
20 | Correct | 3 ms | 376 KB | Output is correct |
21 | Correct | 22 ms | 504 KB | Output is correct |
22 | Correct | 27 ms | 504 KB | Output is correct |
23 | Correct | 13 ms | 492 KB | Output is correct |
24 | Correct | 46 ms | 632 KB | Output is correct |
25 | Correct | 85 ms | 828 KB | Output is correct |
26 | Correct | 97 ms | 988 KB | Output is correct |
27 | Correct | 83 ms | 760 KB | Output is correct |
28 | Correct | 85 ms | 760 KB | Output is correct |
29 | Correct | 84 ms | 760 KB | Output is correct |
30 | Correct | 40 ms | 632 KB | Output is correct |
31 | Correct | 81 ms | 888 KB | Output is correct |
32 | Correct | 51 ms | 612 KB | Output is correct |
33 | Correct | 79 ms | 888 KB | Output is correct |
34 | Correct | 79 ms | 888 KB | Output is correct |
35 | Correct | 79 ms | 888 KB | Output is correct |
36 | Correct | 50 ms | 632 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 256 KB | Output is correct |
4 | Correct | 2 ms | 376 KB | Output is correct |
5 | Correct | 3 ms | 376 KB | Output is correct |
6 | Correct | 2 ms | 376 KB | Output is correct |
7 | Correct | 3 ms | 376 KB | Output is correct |
8 | Correct | 4 ms | 380 KB | Output is correct |
9 | Correct | 2 ms | 376 KB | Output is correct |
10 | Correct | 3 ms | 376 KB | Output is correct |
11 | Correct | 3 ms | 376 KB | Output is correct |
12 | Correct | 3 ms | 376 KB | Output is correct |
13 | Correct | 2 ms | 376 KB | Output is correct |
14 | Correct | 3 ms | 376 KB | Output is correct |
15 | Correct | 2 ms | 376 KB | Output is correct |
16 | Correct | 2 ms | 364 KB | Output is correct |
17 | Correct | 2 ms | 376 KB | Output is correct |
18 | Correct | 2 ms | 376 KB | Output is correct |
19 | Correct | 2 ms | 376 KB | Output is correct |
20 | Correct | 3 ms | 376 KB | Output is correct |
21 | Correct | 22 ms | 504 KB | Output is correct |
22 | Correct | 27 ms | 504 KB | Output is correct |
23 | Correct | 13 ms | 492 KB | Output is correct |
24 | Correct | 46 ms | 632 KB | Output is correct |
25 | Correct | 85 ms | 828 KB | Output is correct |
26 | Correct | 97 ms | 988 KB | Output is correct |
27 | Correct | 83 ms | 760 KB | Output is correct |
28 | Correct | 85 ms | 760 KB | Output is correct |
29 | Correct | 84 ms | 760 KB | Output is correct |
30 | Correct | 40 ms | 632 KB | Output is correct |
31 | Correct | 81 ms | 888 KB | Output is correct |
32 | Correct | 51 ms | 612 KB | Output is correct |
33 | Correct | 79 ms | 888 KB | Output is correct |
34 | Correct | 79 ms | 888 KB | Output is correct |
35 | Correct | 79 ms | 888 KB | Output is correct |
36 | Correct | 50 ms | 632 KB | Output is correct |
37 | Correct | 471 ms | 1500 KB | Output is correct |
38 | Correct | 504 ms | 1628 KB | Output is correct |
39 | Execution timed out | 1083 ms | 3448 KB | Time limit exceeded |
40 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 256 KB | Output is correct |
4 | Correct | 2 ms | 376 KB | Output is correct |
5 | Correct | 3 ms | 376 KB | Output is correct |
6 | Correct | 2 ms | 376 KB | Output is correct |
7 | Correct | 3 ms | 376 KB | Output is correct |
8 | Correct | 4 ms | 380 KB | Output is correct |
9 | Correct | 2 ms | 376 KB | Output is correct |
10 | Correct | 3 ms | 376 KB | Output is correct |
11 | Correct | 3 ms | 376 KB | Output is correct |
12 | Correct | 3 ms | 376 KB | Output is correct |
13 | Correct | 2 ms | 376 KB | Output is correct |
14 | Correct | 3 ms | 376 KB | Output is correct |
15 | Correct | 2 ms | 376 KB | Output is correct |
16 | Correct | 2 ms | 364 KB | Output is correct |
17 | Correct | 2 ms | 376 KB | Output is correct |
18 | Correct | 2 ms | 376 KB | Output is correct |
19 | Correct | 2 ms | 376 KB | Output is correct |
20 | Correct | 3 ms | 376 KB | Output is correct |
21 | Correct | 22 ms | 504 KB | Output is correct |
22 | Correct | 27 ms | 504 KB | Output is correct |
23 | Correct | 13 ms | 492 KB | Output is correct |
24 | Correct | 46 ms | 632 KB | Output is correct |
25 | Correct | 85 ms | 828 KB | Output is correct |
26 | Correct | 97 ms | 988 KB | Output is correct |
27 | Correct | 83 ms | 760 KB | Output is correct |
28 | Correct | 85 ms | 760 KB | Output is correct |
29 | Correct | 84 ms | 760 KB | Output is correct |
30 | Correct | 40 ms | 632 KB | Output is correct |
31 | Correct | 81 ms | 888 KB | Output is correct |
32 | Correct | 51 ms | 612 KB | Output is correct |
33 | Correct | 79 ms | 888 KB | Output is correct |
34 | Correct | 79 ms | 888 KB | Output is correct |
35 | Correct | 79 ms | 888 KB | Output is correct |
36 | Correct | 50 ms | 632 KB | Output is correct |
37 | Correct | 471 ms | 1500 KB | Output is correct |
38 | Correct | 504 ms | 1628 KB | Output is correct |
39 | Execution timed out | 1083 ms | 3448 KB | Time limit exceeded |
40 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 256 KB | Output is correct |
4 | Correct | 2 ms | 376 KB | Output is correct |
5 | Correct | 3 ms | 376 KB | Output is correct |
6 | Correct | 2 ms | 376 KB | Output is correct |
7 | Correct | 3 ms | 376 KB | Output is correct |
8 | Correct | 4 ms | 380 KB | Output is correct |
9 | Correct | 2 ms | 376 KB | Output is correct |
10 | Correct | 3 ms | 376 KB | Output is correct |
11 | Correct | 3 ms | 376 KB | Output is correct |
12 | Correct | 3 ms | 376 KB | Output is correct |
13 | Correct | 2 ms | 376 KB | Output is correct |
14 | Correct | 3 ms | 376 KB | Output is correct |
15 | Correct | 2 ms | 376 KB | Output is correct |
16 | Correct | 2 ms | 364 KB | Output is correct |
17 | Correct | 2 ms | 376 KB | Output is correct |
18 | Correct | 2 ms | 376 KB | Output is correct |
19 | Correct | 2 ms | 376 KB | Output is correct |
20 | Correct | 3 ms | 376 KB | Output is correct |
21 | Correct | 22 ms | 504 KB | Output is correct |
22 | Correct | 27 ms | 504 KB | Output is correct |
23 | Correct | 13 ms | 492 KB | Output is correct |
24 | Correct | 46 ms | 632 KB | Output is correct |
25 | Correct | 85 ms | 828 KB | Output is correct |
26 | Correct | 97 ms | 988 KB | Output is correct |
27 | Correct | 83 ms | 760 KB | Output is correct |
28 | Correct | 85 ms | 760 KB | Output is correct |
29 | Correct | 84 ms | 760 KB | Output is correct |
30 | Correct | 40 ms | 632 KB | Output is correct |
31 | Correct | 81 ms | 888 KB | Output is correct |
32 | Correct | 51 ms | 612 KB | Output is correct |
33 | Correct | 79 ms | 888 KB | Output is correct |
34 | Correct | 79 ms | 888 KB | Output is correct |
35 | Correct | 79 ms | 888 KB | Output is correct |
36 | Correct | 50 ms | 632 KB | Output is correct |
37 | Correct | 471 ms | 1500 KB | Output is correct |
38 | Correct | 504 ms | 1628 KB | Output is correct |
39 | Execution timed out | 1083 ms | 3448 KB | Time limit exceeded |
40 | Halted | 0 ms | 0 KB | - |