# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
897613 | 2024-01-03T13:34:16 Z | mihtriii295 | Kas (COCI17_kas) | C++17 | 65 ms | 2652 KB |
#include<bits/stdc++.h> #pragma GCC optimize("O2") #define ll long long #define TIME (1.0 * clock() / CLOCKS_PER_SEC) #define el cout << '\n' using namespace std; const ll N = 1e8 + 1; const ll logN = 20; const ll MOD = 1e9 + 7; int n, a[N], res, f[N], sum; int main(){ if(fopen("coci1617_r4_kas.inp", "r")){ freopen("coci1617_r4_kas.inp", "r", stdin); freopen("coci1617_r4_kas.out", "w", stdout); } ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL); cin >> n; f[0] = 1; for (int i = 1; i <= n; ++i){ cin >> a[i]; sum += a[i]; } for (int i = 1; i <= n; ++i){ for (int j = 2 * sum; j >= a[i]; --j) if (f[j - a[i]] == 1) f[j] = 1; } for (int i = 2 * sum; i >= 0; --i){ if (i & 1) continue; if (f[i] == 1 && f[i / 2] == 1){ cout << i / 2 + sum - i; break; } } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 2396 KB | Output is correct |
2 | Correct | 0 ms | 2396 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 2396 KB | Output is correct |
2 | Incorrect | 1 ms | 2396 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 2396 KB | Output is correct |
2 | Correct | 1 ms | 2396 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 2396 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 2396 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 2396 KB | Output is correct |
2 | Incorrect | 1 ms | 2396 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 2396 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 26 ms | 2652 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 47 ms | 2648 KB | Output is correct |
2 | Correct | 57 ms | 2544 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 65 ms | 2564 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |