# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
38245 | 2018-01-03T06:54:26 Z | mirbek01 | Bootfall (IZhO17_bootfall) | C++14 | 0 ms | 4944 KB |
# include <bits/stdc++.h> # define pb push_back # define fr first # define sc second # define mk make_pair using namespace std; const long long linf = 1e18 + 7; const int inf = 1e9 + 7; const int N = 250005; typedef long long ll; int n, a[N], dp[N], cnt[N], s; vector <int> ans; int main(){ dp[0] = 1; scanf("%d", &n); for(int i = 1; i <= n; i ++){ scanf("%d", &a[i]); s += a[i]; } for(int i = 1; i <= n; i ++){ int ss = 0; for(int j = 1; j <= s; j ++) dp[j] = 0; for(int j = 1; j <= n; j ++){ if(j != i){ ss += a[j]; for(int k = s; k - a[j] >= 0; k --) dp[k] += dp[k - a[j]]; } } for(int j = ss / 2 + 1; j <= ss; j ++) if(dp[j]) cnt[j * 2 - ss] ++; } for(int i = 1; i <= s; i ++) if(cnt[i] == n) ans.pb(i); sort(ans.begin(), ans.end()); printf("%d\n", ans.size()); for(int i : ans) printf("%d ", i); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 4944 KB | Output is correct |
2 | Correct | 0 ms | 4944 KB | Output is correct |
3 | Incorrect | 0 ms | 4944 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 4944 KB | Output is correct |
2 | Correct | 0 ms | 4944 KB | Output is correct |
3 | Incorrect | 0 ms | 4944 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 4944 KB | Output is correct |
2 | Correct | 0 ms | 4944 KB | Output is correct |
3 | Incorrect | 0 ms | 4944 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 4944 KB | Output is correct |
2 | Correct | 0 ms | 4944 KB | Output is correct |
3 | Incorrect | 0 ms | 4944 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 4944 KB | Output is correct |
2 | Correct | 0 ms | 4944 KB | Output is correct |
3 | Incorrect | 0 ms | 4944 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 4944 KB | Output is correct |
2 | Correct | 0 ms | 4944 KB | Output is correct |
3 | Incorrect | 0 ms | 4944 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |