# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
566503 | 2022-05-22T11:14:20 Z | 1zaid1 | Bootfall (IZhO17_bootfall) | C++14 | 1000 ms | 324 KB |
#include <bits/stdc++.h> using namespace std; #define endl '\n' typedef long long ll; #define int long long #pragma GCC diagnostic ignored "-Wunused-result" void setIO(string name = "") { ios_base::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(15); if (name.size()) { freopen((name+".in").c_str(), "r", stdin); freopen((name+".out").c_str(), "w", stdout); } } const int M = 5e2+5, MOD = 1e6+7; int sum; bool check(vector<int>& v) { if (sum%2) return 0; vector<bool> can(2*sum+10, 0); can[0] = 1; for (int i = 0; i < v.size(); i++) { for (int k = sum/2; k >= v[i]; k--) { if (can[k-v[i]]) can[k] = 1; } } return can[sum/2]; } signed main() { ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); srand(time(0)); // setIO("citystate"); int n; cin >> n; vector<int> v(n); for (int&i:v) cin >> i; for (int i:v) sum += i; if (!check(v)) { cout << 0 << endl; return 0; } vector<int> ans; for (int i = 1; i <= sum; i++) { bool ok = 1; for (int j = 0; j < n; j++) { sum += i-v[j]; swap(v[j], i); ok &= check(v); swap(v[j], i); sum -= i-v[j]; } if (ok) ans.push_back(i); } cout << ans.size() << endl; for (int i:ans) cout << i << ' '; cout << endl; return 0; } /* 4 1 3 1 5 */
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 212 KB | Output is correct |
4 | Correct | 3 ms | 212 KB | Output is correct |
5 | Correct | 70 ms | 320 KB | Output is correct |
6 | Correct | 2 ms | 212 KB | Output is correct |
7 | Correct | 2 ms | 212 KB | Output is correct |
8 | Correct | 165 ms | 324 KB | Output is correct |
9 | Correct | 16 ms | 316 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 212 KB | Output is correct |
4 | Correct | 3 ms | 212 KB | Output is correct |
5 | Correct | 70 ms | 320 KB | Output is correct |
6 | Correct | 2 ms | 212 KB | Output is correct |
7 | Correct | 2 ms | 212 KB | Output is correct |
8 | Correct | 165 ms | 324 KB | Output is correct |
9 | Correct | 16 ms | 316 KB | Output is correct |
10 | Correct | 140 ms | 292 KB | Output is correct |
11 | Correct | 37 ms | 212 KB | Output is correct |
12 | Correct | 59 ms | 296 KB | Output is correct |
13 | Correct | 28 ms | 212 KB | Output is correct |
14 | Correct | 44 ms | 320 KB | Output is correct |
15 | Correct | 24 ms | 324 KB | Output is correct |
16 | Correct | 34 ms | 320 KB | Output is correct |
17 | Correct | 8 ms | 320 KB | Output is correct |
18 | Correct | 23 ms | 324 KB | Output is correct |
19 | Correct | 19 ms | 320 KB | Output is correct |
20 | Correct | 153 ms | 296 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 212 KB | Output is correct |
4 | Correct | 3 ms | 212 KB | Output is correct |
5 | Correct | 70 ms | 320 KB | Output is correct |
6 | Correct | 2 ms | 212 KB | Output is correct |
7 | Correct | 2 ms | 212 KB | Output is correct |
8 | Correct | 165 ms | 324 KB | Output is correct |
9 | Correct | 16 ms | 316 KB | Output is correct |
10 | Correct | 140 ms | 292 KB | Output is correct |
11 | Correct | 37 ms | 212 KB | Output is correct |
12 | Correct | 59 ms | 296 KB | Output is correct |
13 | Correct | 28 ms | 212 KB | Output is correct |
14 | Correct | 44 ms | 320 KB | Output is correct |
15 | Correct | 24 ms | 324 KB | Output is correct |
16 | Correct | 34 ms | 320 KB | Output is correct |
17 | Correct | 8 ms | 320 KB | Output is correct |
18 | Correct | 23 ms | 324 KB | Output is correct |
19 | Correct | 19 ms | 320 KB | Output is correct |
20 | Correct | 153 ms | 296 KB | Output is correct |
21 | Execution timed out | 1083 ms | 300 KB | Time limit exceeded |
22 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 212 KB | Output is correct |
4 | Correct | 3 ms | 212 KB | Output is correct |
5 | Correct | 70 ms | 320 KB | Output is correct |
6 | Correct | 2 ms | 212 KB | Output is correct |
7 | Correct | 2 ms | 212 KB | Output is correct |
8 | Correct | 165 ms | 324 KB | Output is correct |
9 | Correct | 16 ms | 316 KB | Output is correct |
10 | Correct | 140 ms | 292 KB | Output is correct |
11 | Correct | 37 ms | 212 KB | Output is correct |
12 | Correct | 59 ms | 296 KB | Output is correct |
13 | Correct | 28 ms | 212 KB | Output is correct |
14 | Correct | 44 ms | 320 KB | Output is correct |
15 | Correct | 24 ms | 324 KB | Output is correct |
16 | Correct | 34 ms | 320 KB | Output is correct |
17 | Correct | 8 ms | 320 KB | Output is correct |
18 | Correct | 23 ms | 324 KB | Output is correct |
19 | Correct | 19 ms | 320 KB | Output is correct |
20 | Correct | 153 ms | 296 KB | Output is correct |
21 | Execution timed out | 1083 ms | 300 KB | Time limit exceeded |
22 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 212 KB | Output is correct |
4 | Correct | 3 ms | 212 KB | Output is correct |
5 | Correct | 70 ms | 320 KB | Output is correct |
6 | Correct | 2 ms | 212 KB | Output is correct |
7 | Correct | 2 ms | 212 KB | Output is correct |
8 | Correct | 165 ms | 324 KB | Output is correct |
9 | Correct | 16 ms | 316 KB | Output is correct |
10 | Correct | 140 ms | 292 KB | Output is correct |
11 | Correct | 37 ms | 212 KB | Output is correct |
12 | Correct | 59 ms | 296 KB | Output is correct |
13 | Correct | 28 ms | 212 KB | Output is correct |
14 | Correct | 44 ms | 320 KB | Output is correct |
15 | Correct | 24 ms | 324 KB | Output is correct |
16 | Correct | 34 ms | 320 KB | Output is correct |
17 | Correct | 8 ms | 320 KB | Output is correct |
18 | Correct | 23 ms | 324 KB | Output is correct |
19 | Correct | 19 ms | 320 KB | Output is correct |
20 | Correct | 153 ms | 296 KB | Output is correct |
21 | Execution timed out | 1083 ms | 300 KB | Time limit exceeded |
22 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 212 KB | Output is correct |
4 | Correct | 3 ms | 212 KB | Output is correct |
5 | Correct | 70 ms | 320 KB | Output is correct |
6 | Correct | 2 ms | 212 KB | Output is correct |
7 | Correct | 2 ms | 212 KB | Output is correct |
8 | Correct | 165 ms | 324 KB | Output is correct |
9 | Correct | 16 ms | 316 KB | Output is correct |
10 | Correct | 140 ms | 292 KB | Output is correct |
11 | Correct | 37 ms | 212 KB | Output is correct |
12 | Correct | 59 ms | 296 KB | Output is correct |
13 | Correct | 28 ms | 212 KB | Output is correct |
14 | Correct | 44 ms | 320 KB | Output is correct |
15 | Correct | 24 ms | 324 KB | Output is correct |
16 | Correct | 34 ms | 320 KB | Output is correct |
17 | Correct | 8 ms | 320 KB | Output is correct |
18 | Correct | 23 ms | 324 KB | Output is correct |
19 | Correct | 19 ms | 320 KB | Output is correct |
20 | Correct | 153 ms | 296 KB | Output is correct |
21 | Execution timed out | 1083 ms | 300 KB | Time limit exceeded |
22 | Halted | 0 ms | 0 KB | - |