# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
168076 | 2019-12-11T09:12:19 Z | Gurban | Bootfall (IZhO17_bootfall) | C++14 | 1000 ms | 13944 KB |
#include <bits/stdc++.h> #define pb push_back #define ss second #define ff first #define N 250000 #define inf 1000000009 #define ll long long #define mid(a,b) (a+b)/2 using namespace std; int n,a[N],sum,sum1,l; int c[N][509],s[N][509],dp[509][N]; map <int,int> m; vector <int> v; int main() { scanf("%d",&n); for(int i = 1;i <= n;i++){ scanf("%d",&a[i]); sum += a[i]; s[0][i] = 1; c[0][i] = 1; } c[0][0] = 1; s[0][0] = 1; sum1 = ceil(double(sum)/2.0); for(int i = 1;i <= sum;i++) for(int j = 1;j <= n;j++) if(c[i][j - 1] or (i >= a[j] and c[i - a[j]][j - 1] > 0)) c[i][j] = 1; for(int i = 1;i <= sum;i++){ for(int j = n;j >= 1;j--){ l = n - j + 1; if(s[i][l - 1] or (i >= a[j] and s[i - a[j]][l - 1] > 0)) s[i][l] = 1; } } if(sum % 2 == 1 or (c[sum1][n] == 0)) return cout << 0,0; for(int i = 1;i <= n;i++){ for(int j = 1;j <= sum;j++){ for(int k = 1;k <= sum;k++){ if(c[j][i - 1]) dp[i][j] = 1; if(s[k][n - i]) dp[i][k] = 1; if(c[j][i - 1] and s[k][n - i]){ dp[i][j + k] = 1; } } } } for(int i = 1;i <= n;i++) dp[i][0] = 1; for(int i = 1;i <= n;i++){ for(int j = 1;j < sum;j++){ l = sum - a[i] + j; if(l % 2 == 1) continue; if(dp[i][l / 2 - j]) m[j]++; } } 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 | 508 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
4 | Correct | 5 ms | 376 KB | Output is correct |
5 | Correct | 20 ms | 3576 KB | Output is correct |
6 | Correct | 3 ms | 1016 KB | Output is correct |
7 | Correct | 3 ms | 760 KB | Output is correct |
8 | Correct | 50 ms | 5496 KB | Output is correct |
9 | Correct | 8 ms | 2168 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 508 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
4 | Correct | 5 ms | 376 KB | Output is correct |
5 | Correct | 20 ms | 3576 KB | Output is correct |
6 | Correct | 3 ms | 1016 KB | Output is correct |
7 | Correct | 3 ms | 760 KB | Output is correct |
8 | Correct | 50 ms | 5496 KB | Output is correct |
9 | Correct | 8 ms | 2168 KB | Output is correct |
10 | Correct | 12 ms | 872 KB | Output is correct |
11 | Correct | 6 ms | 1528 KB | Output is correct |
12 | Correct | 9 ms | 2168 KB | Output is correct |
13 | Correct | 5 ms | 1528 KB | Output is correct |
14 | Correct | 7 ms | 1656 KB | Output is correct |
15 | Correct | 5 ms | 1400 KB | Output is correct |
16 | Correct | 6 ms | 1528 KB | Output is correct |
17 | Correct | 4 ms | 1144 KB | Output is correct |
18 | Correct | 5 ms | 1528 KB | Output is correct |
19 | Correct | 4 ms | 1272 KB | Output is correct |
20 | Correct | 13 ms | 888 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 508 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
4 | Correct | 5 ms | 376 KB | Output is correct |
5 | Correct | 20 ms | 3576 KB | Output is correct |
6 | Correct | 3 ms | 1016 KB | Output is correct |
7 | Correct | 3 ms | 760 KB | Output is correct |
8 | Correct | 50 ms | 5496 KB | Output is correct |
9 | Correct | 8 ms | 2168 KB | Output is correct |
10 | Correct | 12 ms | 872 KB | Output is correct |
11 | Correct | 6 ms | 1528 KB | Output is correct |
12 | Correct | 9 ms | 2168 KB | Output is correct |
13 | Correct | 5 ms | 1528 KB | Output is correct |
14 | Correct | 7 ms | 1656 KB | Output is correct |
15 | Correct | 5 ms | 1400 KB | Output is correct |
16 | Correct | 6 ms | 1528 KB | Output is correct |
17 | Correct | 4 ms | 1144 KB | Output is correct |
18 | Correct | 5 ms | 1528 KB | Output is correct |
19 | Correct | 4 ms | 1272 KB | Output is correct |
20 | Correct | 13 ms | 888 KB | Output is correct |
21 | Execution timed out | 1078 ms | 13944 KB | Time limit exceeded |
22 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 508 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
4 | Correct | 5 ms | 376 KB | Output is correct |
5 | Correct | 20 ms | 3576 KB | Output is correct |
6 | Correct | 3 ms | 1016 KB | Output is correct |
7 | Correct | 3 ms | 760 KB | Output is correct |
8 | Correct | 50 ms | 5496 KB | Output is correct |
9 | Correct | 8 ms | 2168 KB | Output is correct |
10 | Correct | 12 ms | 872 KB | Output is correct |
11 | Correct | 6 ms | 1528 KB | Output is correct |
12 | Correct | 9 ms | 2168 KB | Output is correct |
13 | Correct | 5 ms | 1528 KB | Output is correct |
14 | Correct | 7 ms | 1656 KB | Output is correct |
15 | Correct | 5 ms | 1400 KB | Output is correct |
16 | Correct | 6 ms | 1528 KB | Output is correct |
17 | Correct | 4 ms | 1144 KB | Output is correct |
18 | Correct | 5 ms | 1528 KB | Output is correct |
19 | Correct | 4 ms | 1272 KB | Output is correct |
20 | Correct | 13 ms | 888 KB | Output is correct |
21 | Execution timed out | 1078 ms | 13944 KB | Time limit exceeded |
22 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 508 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
4 | Correct | 5 ms | 376 KB | Output is correct |
5 | Correct | 20 ms | 3576 KB | Output is correct |
6 | Correct | 3 ms | 1016 KB | Output is correct |
7 | Correct | 3 ms | 760 KB | Output is correct |
8 | Correct | 50 ms | 5496 KB | Output is correct |
9 | Correct | 8 ms | 2168 KB | Output is correct |
10 | Correct | 12 ms | 872 KB | Output is correct |
11 | Correct | 6 ms | 1528 KB | Output is correct |
12 | Correct | 9 ms | 2168 KB | Output is correct |
13 | Correct | 5 ms | 1528 KB | Output is correct |
14 | Correct | 7 ms | 1656 KB | Output is correct |
15 | Correct | 5 ms | 1400 KB | Output is correct |
16 | Correct | 6 ms | 1528 KB | Output is correct |
17 | Correct | 4 ms | 1144 KB | Output is correct |
18 | Correct | 5 ms | 1528 KB | Output is correct |
19 | Correct | 4 ms | 1272 KB | Output is correct |
20 | Correct | 13 ms | 888 KB | Output is correct |
21 | Execution timed out | 1078 ms | 13944 KB | Time limit exceeded |
22 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 508 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
4 | Correct | 5 ms | 376 KB | Output is correct |
5 | Correct | 20 ms | 3576 KB | Output is correct |
6 | Correct | 3 ms | 1016 KB | Output is correct |
7 | Correct | 3 ms | 760 KB | Output is correct |
8 | Correct | 50 ms | 5496 KB | Output is correct |
9 | Correct | 8 ms | 2168 KB | Output is correct |
10 | Correct | 12 ms | 872 KB | Output is correct |
11 | Correct | 6 ms | 1528 KB | Output is correct |
12 | Correct | 9 ms | 2168 KB | Output is correct |
13 | Correct | 5 ms | 1528 KB | Output is correct |
14 | Correct | 7 ms | 1656 KB | Output is correct |
15 | Correct | 5 ms | 1400 KB | Output is correct |
16 | Correct | 6 ms | 1528 KB | Output is correct |
17 | Correct | 4 ms | 1144 KB | Output is correct |
18 | Correct | 5 ms | 1528 KB | Output is correct |
19 | Correct | 4 ms | 1272 KB | Output is correct |
20 | Correct | 13 ms | 888 KB | Output is correct |
21 | Execution timed out | 1078 ms | 13944 KB | Time limit exceeded |
22 | Halted | 0 ms | 0 KB | - |