# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
91124 | 2018-12-26T10:22:17 Z | Vardanyan | Bootfall (IZhO17_bootfall) | C++14 | 1000 ms | 15216 KB |
#include<bits/stdc++.h> using namespace std; const int N = 505; int dp[N][N*N]; int a[N]; int main() { int n; scanf("%d",&n); int MX = 0; int sum = 0; for(int i = 1;i<=n;i++){ scanf("%d",&a[i]); MX+=a[i]; sum+=a[i]; dp[i][0] = 1; } sort(a+1,a+1+n); dp[0][0] = 1; for(int i = 0;i<=n;i++){ for(int j = 1;j<=n;j++){ if(j == i) continue; for(int s = 2*MX;s>=0;s--){ if(dp[i][s]) dp[i][s+a[j]] = 1; } } // for(int s = 0;s<=2*MX;s++) cout<<dp[i][s]<<" "; // cout<<endl; } //cout<<sum<<endl; //cout<<dp[0][sum/2]<<endl; if(!dp[0][sum/2]){ printf("0\n"); return 0; } vector<int> ans; for(int x = 1;x<=MX;x++){ sum+=x; bool F = true; for(int i = 1;i<=n;i++){ sum-=a[i]; int need = sum/2; sum+=a[i]; if(dp[i][need-x] && (sum-a[i])%2 == 0) continue; F = false; break; } sum-=x; if(F) ans.push_back(x); } printf("%d\n",ans.size()); for(int i = 0;i<ans.size();i++) printf("%d ",ans[i]); printf("\n"); return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 452 KB | Output is correct |
3 | Correct | 2 ms | 452 KB | Output is correct |
4 | Correct | 2 ms | 484 KB | Output is correct |
5 | Correct | 2 ms | 484 KB | Output is correct |
6 | Correct | 2 ms | 608 KB | Output is correct |
7 | Correct | 2 ms | 624 KB | Output is correct |
8 | Correct | 2 ms | 624 KB | Output is correct |
9 | Correct | 2 ms | 624 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 452 KB | Output is correct |
3 | Correct | 2 ms | 452 KB | Output is correct |
4 | Correct | 2 ms | 484 KB | Output is correct |
5 | Correct | 2 ms | 484 KB | Output is correct |
6 | Correct | 2 ms | 608 KB | Output is correct |
7 | Correct | 2 ms | 624 KB | Output is correct |
8 | Correct | 2 ms | 624 KB | Output is correct |
9 | Correct | 2 ms | 624 KB | Output is correct |
10 | Correct | 3 ms | 832 KB | Output is correct |
11 | Correct | 2 ms | 832 KB | Output is correct |
12 | Correct | 2 ms | 852 KB | Output is correct |
13 | Correct | 2 ms | 852 KB | Output is correct |
14 | Correct | 2 ms | 852 KB | Output is correct |
15 | Correct | 2 ms | 852 KB | Output is correct |
16 | Correct | 2 ms | 908 KB | Output is correct |
17 | Correct | 2 ms | 908 KB | Output is correct |
18 | Correct | 2 ms | 908 KB | Output is correct |
19 | Correct | 2 ms | 908 KB | Output is correct |
20 | Correct | 3 ms | 908 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 452 KB | Output is correct |
3 | Correct | 2 ms | 452 KB | Output is correct |
4 | Correct | 2 ms | 484 KB | Output is correct |
5 | Correct | 2 ms | 484 KB | Output is correct |
6 | Correct | 2 ms | 608 KB | Output is correct |
7 | Correct | 2 ms | 624 KB | Output is correct |
8 | Correct | 2 ms | 624 KB | Output is correct |
9 | Correct | 2 ms | 624 KB | Output is correct |
10 | Correct | 3 ms | 832 KB | Output is correct |
11 | Correct | 2 ms | 832 KB | Output is correct |
12 | Correct | 2 ms | 852 KB | Output is correct |
13 | Correct | 2 ms | 852 KB | Output is correct |
14 | Correct | 2 ms | 852 KB | Output is correct |
15 | Correct | 2 ms | 852 KB | Output is correct |
16 | Correct | 2 ms | 908 KB | Output is correct |
17 | Correct | 2 ms | 908 KB | Output is correct |
18 | Correct | 2 ms | 908 KB | Output is correct |
19 | Correct | 2 ms | 908 KB | Output is correct |
20 | Correct | 3 ms | 908 KB | Output is correct |
21 | Correct | 24 ms | 1844 KB | Output is correct |
22 | Correct | 33 ms | 2032 KB | Output is correct |
23 | Correct | 12 ms | 2032 KB | Output is correct |
24 | Correct | 69 ms | 2908 KB | Output is correct |
25 | Correct | 139 ms | 4652 KB | Output is correct |
26 | Correct | 165 ms | 5120 KB | Output is correct |
27 | Correct | 144 ms | 5120 KB | Output is correct |
28 | Correct | 157 ms | 5120 KB | Output is correct |
29 | Correct | 163 ms | 5152 KB | Output is correct |
30 | Correct | 84 ms | 5152 KB | Output is correct |
31 | Correct | 126 ms | 5152 KB | Output is correct |
32 | Correct | 80 ms | 5152 KB | Output is correct |
33 | Correct | 161 ms | 5308 KB | Output is correct |
34 | Correct | 157 ms | 5416 KB | Output is correct |
35 | Correct | 163 ms | 5416 KB | Output is correct |
36 | Correct | 76 ms | 5416 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 452 KB | Output is correct |
3 | Correct | 2 ms | 452 KB | Output is correct |
4 | Correct | 2 ms | 484 KB | Output is correct |
5 | Correct | 2 ms | 484 KB | Output is correct |
6 | Correct | 2 ms | 608 KB | Output is correct |
7 | Correct | 2 ms | 624 KB | Output is correct |
8 | Correct | 2 ms | 624 KB | Output is correct |
9 | Correct | 2 ms | 624 KB | Output is correct |
10 | Correct | 3 ms | 832 KB | Output is correct |
11 | Correct | 2 ms | 832 KB | Output is correct |
12 | Correct | 2 ms | 852 KB | Output is correct |
13 | Correct | 2 ms | 852 KB | Output is correct |
14 | Correct | 2 ms | 852 KB | Output is correct |
15 | Correct | 2 ms | 852 KB | Output is correct |
16 | Correct | 2 ms | 908 KB | Output is correct |
17 | Correct | 2 ms | 908 KB | Output is correct |
18 | Correct | 2 ms | 908 KB | Output is correct |
19 | Correct | 2 ms | 908 KB | Output is correct |
20 | Correct | 3 ms | 908 KB | Output is correct |
21 | Correct | 24 ms | 1844 KB | Output is correct |
22 | Correct | 33 ms | 2032 KB | Output is correct |
23 | Correct | 12 ms | 2032 KB | Output is correct |
24 | Correct | 69 ms | 2908 KB | Output is correct |
25 | Correct | 139 ms | 4652 KB | Output is correct |
26 | Correct | 165 ms | 5120 KB | Output is correct |
27 | Correct | 144 ms | 5120 KB | Output is correct |
28 | Correct | 157 ms | 5120 KB | Output is correct |
29 | Correct | 163 ms | 5152 KB | Output is correct |
30 | Correct | 84 ms | 5152 KB | Output is correct |
31 | Correct | 126 ms | 5152 KB | Output is correct |
32 | Correct | 80 ms | 5152 KB | Output is correct |
33 | Correct | 161 ms | 5308 KB | Output is correct |
34 | Correct | 157 ms | 5416 KB | Output is correct |
35 | Correct | 163 ms | 5416 KB | Output is correct |
36 | Correct | 76 ms | 5416 KB | Output is correct |
37 | Execution timed out | 1072 ms | 15216 KB | Time limit exceeded |
38 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 452 KB | Output is correct |
3 | Correct | 2 ms | 452 KB | Output is correct |
4 | Correct | 2 ms | 484 KB | Output is correct |
5 | Correct | 2 ms | 484 KB | Output is correct |
6 | Correct | 2 ms | 608 KB | Output is correct |
7 | Correct | 2 ms | 624 KB | Output is correct |
8 | Correct | 2 ms | 624 KB | Output is correct |
9 | Correct | 2 ms | 624 KB | Output is correct |
10 | Correct | 3 ms | 832 KB | Output is correct |
11 | Correct | 2 ms | 832 KB | Output is correct |
12 | Correct | 2 ms | 852 KB | Output is correct |
13 | Correct | 2 ms | 852 KB | Output is correct |
14 | Correct | 2 ms | 852 KB | Output is correct |
15 | Correct | 2 ms | 852 KB | Output is correct |
16 | Correct | 2 ms | 908 KB | Output is correct |
17 | Correct | 2 ms | 908 KB | Output is correct |
18 | Correct | 2 ms | 908 KB | Output is correct |
19 | Correct | 2 ms | 908 KB | Output is correct |
20 | Correct | 3 ms | 908 KB | Output is correct |
21 | Correct | 24 ms | 1844 KB | Output is correct |
22 | Correct | 33 ms | 2032 KB | Output is correct |
23 | Correct | 12 ms | 2032 KB | Output is correct |
24 | Correct | 69 ms | 2908 KB | Output is correct |
25 | Correct | 139 ms | 4652 KB | Output is correct |
26 | Correct | 165 ms | 5120 KB | Output is correct |
27 | Correct | 144 ms | 5120 KB | Output is correct |
28 | Correct | 157 ms | 5120 KB | Output is correct |
29 | Correct | 163 ms | 5152 KB | Output is correct |
30 | Correct | 84 ms | 5152 KB | Output is correct |
31 | Correct | 126 ms | 5152 KB | Output is correct |
32 | Correct | 80 ms | 5152 KB | Output is correct |
33 | Correct | 161 ms | 5308 KB | Output is correct |
34 | Correct | 157 ms | 5416 KB | Output is correct |
35 | Correct | 163 ms | 5416 KB | Output is correct |
36 | Correct | 76 ms | 5416 KB | Output is correct |
37 | Execution timed out | 1072 ms | 15216 KB | Time limit exceeded |
38 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 452 KB | Output is correct |
3 | Correct | 2 ms | 452 KB | Output is correct |
4 | Correct | 2 ms | 484 KB | Output is correct |
5 | Correct | 2 ms | 484 KB | Output is correct |
6 | Correct | 2 ms | 608 KB | Output is correct |
7 | Correct | 2 ms | 624 KB | Output is correct |
8 | Correct | 2 ms | 624 KB | Output is correct |
9 | Correct | 2 ms | 624 KB | Output is correct |
10 | Correct | 3 ms | 832 KB | Output is correct |
11 | Correct | 2 ms | 832 KB | Output is correct |
12 | Correct | 2 ms | 852 KB | Output is correct |
13 | Correct | 2 ms | 852 KB | Output is correct |
14 | Correct | 2 ms | 852 KB | Output is correct |
15 | Correct | 2 ms | 852 KB | Output is correct |
16 | Correct | 2 ms | 908 KB | Output is correct |
17 | Correct | 2 ms | 908 KB | Output is correct |
18 | Correct | 2 ms | 908 KB | Output is correct |
19 | Correct | 2 ms | 908 KB | Output is correct |
20 | Correct | 3 ms | 908 KB | Output is correct |
21 | Correct | 24 ms | 1844 KB | Output is correct |
22 | Correct | 33 ms | 2032 KB | Output is correct |
23 | Correct | 12 ms | 2032 KB | Output is correct |
24 | Correct | 69 ms | 2908 KB | Output is correct |
25 | Correct | 139 ms | 4652 KB | Output is correct |
26 | Correct | 165 ms | 5120 KB | Output is correct |
27 | Correct | 144 ms | 5120 KB | Output is correct |
28 | Correct | 157 ms | 5120 KB | Output is correct |
29 | Correct | 163 ms | 5152 KB | Output is correct |
30 | Correct | 84 ms | 5152 KB | Output is correct |
31 | Correct | 126 ms | 5152 KB | Output is correct |
32 | Correct | 80 ms | 5152 KB | Output is correct |
33 | Correct | 161 ms | 5308 KB | Output is correct |
34 | Correct | 157 ms | 5416 KB | Output is correct |
35 | Correct | 163 ms | 5416 KB | Output is correct |
36 | Correct | 76 ms | 5416 KB | Output is correct |
37 | Execution timed out | 1072 ms | 15216 KB | Time limit exceeded |
38 | Halted | 0 ms | 0 KB | - |