# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
36792 | 2017-12-14T17:20:44 Z | top34051 | Bootfall (IZhO17_bootfall) | C++14 | 53 ms | 5152 KB |
#include<bits/stdc++.h> using namespace std; const int maxn = 305; const int mx = 160000; int n; int a[maxn], cnt[mx+505]; long long dp[mx+505], temp[mx+505]; vector<int> ans; int main() { scanf("%d",&n); for(int i=1;i<=n;i++) scanf("%d",&a[i]); int sum = 0; for(int i=1;i<=n;i++) sum += a[i]; dp[0] = 1; for(int i=1;i<=n;i++) { for(int x=mx;x>=0;x--) dp[x+a[i]] += dp[x]; // for(int x=0;x<=mx;x++) printf("%lld ",dp[x]); // printf("\n"); } if(sum%2!=0 || dp[sum/2]==0) return !printf("0"); for(int i=1;i<=n;i++) { memset(temp,0,sizeof(temp)); for(int x=0;x<=mx;x++) { temp[x] += dp[x]; temp[x+a[i]] -= temp[x]; } // printf("%d : ",i); for(int x=0;x<=mx;x++) { // printf("%d ",temp[x]); if(temp[x]>0) cnt[max(0,sum-a[i]-2*x)]++; } // printf("\n"); } for(int i=1;i<=mx;i++) if(cnt[i]==n) ans.push_back(i); printf("%d\n",ans.size()); for(auto x : ans) printf("%d ",x); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 5152 KB | Output is correct |
2 | Correct | 6 ms | 5152 KB | Output is correct |
3 | Correct | 0 ms | 5152 KB | Output is correct |
4 | Correct | 3 ms | 5152 KB | Output is correct |
5 | Correct | 3 ms | 5152 KB | Output is correct |
6 | Correct | 6 ms | 5152 KB | Output is correct |
7 | Correct | 6 ms | 5152 KB | Output is correct |
8 | Correct | 9 ms | 5152 KB | Output is correct |
9 | Correct | 9 ms | 5152 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 5152 KB | Output is correct |
2 | Correct | 6 ms | 5152 KB | Output is correct |
3 | Correct | 0 ms | 5152 KB | Output is correct |
4 | Correct | 3 ms | 5152 KB | Output is correct |
5 | Correct | 3 ms | 5152 KB | Output is correct |
6 | Correct | 6 ms | 5152 KB | Output is correct |
7 | Correct | 6 ms | 5152 KB | Output is correct |
8 | Correct | 9 ms | 5152 KB | Output is correct |
9 | Correct | 9 ms | 5152 KB | Output is correct |
10 | Correct | 19 ms | 5152 KB | Output is correct |
11 | Correct | 33 ms | 5152 KB | Output is correct |
12 | Correct | 19 ms | 5152 KB | Output is correct |
13 | Correct | 13 ms | 5152 KB | Output is correct |
14 | Correct | 23 ms | 5152 KB | Output is correct |
15 | Correct | 19 ms | 5152 KB | Output is correct |
16 | Correct | 23 ms | 5152 KB | Output is correct |
17 | Correct | 13 ms | 5152 KB | Output is correct |
18 | Correct | 16 ms | 5152 KB | Output is correct |
19 | Correct | 13 ms | 5152 KB | Output is correct |
20 | Correct | 16 ms | 5152 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 5152 KB | Output is correct |
2 | Correct | 6 ms | 5152 KB | Output is correct |
3 | Correct | 0 ms | 5152 KB | Output is correct |
4 | Correct | 3 ms | 5152 KB | Output is correct |
5 | Correct | 3 ms | 5152 KB | Output is correct |
6 | Correct | 6 ms | 5152 KB | Output is correct |
7 | Correct | 6 ms | 5152 KB | Output is correct |
8 | Correct | 9 ms | 5152 KB | Output is correct |
9 | Correct | 9 ms | 5152 KB | Output is correct |
10 | Correct | 19 ms | 5152 KB | Output is correct |
11 | Correct | 33 ms | 5152 KB | Output is correct |
12 | Correct | 19 ms | 5152 KB | Output is correct |
13 | Correct | 13 ms | 5152 KB | Output is correct |
14 | Correct | 23 ms | 5152 KB | Output is correct |
15 | Correct | 19 ms | 5152 KB | Output is correct |
16 | Correct | 23 ms | 5152 KB | Output is correct |
17 | Correct | 13 ms | 5152 KB | Output is correct |
18 | Correct | 16 ms | 5152 KB | Output is correct |
19 | Correct | 13 ms | 5152 KB | Output is correct |
20 | Correct | 16 ms | 5152 KB | Output is correct |
21 | Correct | 43 ms | 5152 KB | Output is correct |
22 | Incorrect | 53 ms | 5152 KB | Output isn't correct |
23 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 5152 KB | Output is correct |
2 | Correct | 6 ms | 5152 KB | Output is correct |
3 | Correct | 0 ms | 5152 KB | Output is correct |
4 | Correct | 3 ms | 5152 KB | Output is correct |
5 | Correct | 3 ms | 5152 KB | Output is correct |
6 | Correct | 6 ms | 5152 KB | Output is correct |
7 | Correct | 6 ms | 5152 KB | Output is correct |
8 | Correct | 9 ms | 5152 KB | Output is correct |
9 | Correct | 9 ms | 5152 KB | Output is correct |
10 | Correct | 19 ms | 5152 KB | Output is correct |
11 | Correct | 33 ms | 5152 KB | Output is correct |
12 | Correct | 19 ms | 5152 KB | Output is correct |
13 | Correct | 13 ms | 5152 KB | Output is correct |
14 | Correct | 23 ms | 5152 KB | Output is correct |
15 | Correct | 19 ms | 5152 KB | Output is correct |
16 | Correct | 23 ms | 5152 KB | Output is correct |
17 | Correct | 13 ms | 5152 KB | Output is correct |
18 | Correct | 16 ms | 5152 KB | Output is correct |
19 | Correct | 13 ms | 5152 KB | Output is correct |
20 | Correct | 16 ms | 5152 KB | Output is correct |
21 | Correct | 43 ms | 5152 KB | Output is correct |
22 | Incorrect | 53 ms | 5152 KB | Output isn't correct |
23 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 5152 KB | Output is correct |
2 | Correct | 6 ms | 5152 KB | Output is correct |
3 | Correct | 0 ms | 5152 KB | Output is correct |
4 | Correct | 3 ms | 5152 KB | Output is correct |
5 | Correct | 3 ms | 5152 KB | Output is correct |
6 | Correct | 6 ms | 5152 KB | Output is correct |
7 | Correct | 6 ms | 5152 KB | Output is correct |
8 | Correct | 9 ms | 5152 KB | Output is correct |
9 | Correct | 9 ms | 5152 KB | Output is correct |
10 | Correct | 19 ms | 5152 KB | Output is correct |
11 | Correct | 33 ms | 5152 KB | Output is correct |
12 | Correct | 19 ms | 5152 KB | Output is correct |
13 | Correct | 13 ms | 5152 KB | Output is correct |
14 | Correct | 23 ms | 5152 KB | Output is correct |
15 | Correct | 19 ms | 5152 KB | Output is correct |
16 | Correct | 23 ms | 5152 KB | Output is correct |
17 | Correct | 13 ms | 5152 KB | Output is correct |
18 | Correct | 16 ms | 5152 KB | Output is correct |
19 | Correct | 13 ms | 5152 KB | Output is correct |
20 | Correct | 16 ms | 5152 KB | Output is correct |
21 | Correct | 43 ms | 5152 KB | Output is correct |
22 | Incorrect | 53 ms | 5152 KB | Output isn't correct |
23 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 5152 KB | Output is correct |
2 | Correct | 6 ms | 5152 KB | Output is correct |
3 | Correct | 0 ms | 5152 KB | Output is correct |
4 | Correct | 3 ms | 5152 KB | Output is correct |
5 | Correct | 3 ms | 5152 KB | Output is correct |
6 | Correct | 6 ms | 5152 KB | Output is correct |
7 | Correct | 6 ms | 5152 KB | Output is correct |
8 | Correct | 9 ms | 5152 KB | Output is correct |
9 | Correct | 9 ms | 5152 KB | Output is correct |
10 | Correct | 19 ms | 5152 KB | Output is correct |
11 | Correct | 33 ms | 5152 KB | Output is correct |
12 | Correct | 19 ms | 5152 KB | Output is correct |
13 | Correct | 13 ms | 5152 KB | Output is correct |
14 | Correct | 23 ms | 5152 KB | Output is correct |
15 | Correct | 19 ms | 5152 KB | Output is correct |
16 | Correct | 23 ms | 5152 KB | Output is correct |
17 | Correct | 13 ms | 5152 KB | Output is correct |
18 | Correct | 16 ms | 5152 KB | Output is correct |
19 | Correct | 13 ms | 5152 KB | Output is correct |
20 | Correct | 16 ms | 5152 KB | Output is correct |
21 | Correct | 43 ms | 5152 KB | Output is correct |
22 | Incorrect | 53 ms | 5152 KB | Output isn't correct |
23 | Halted | 0 ms | 0 KB | - |