# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1100370 |
2024-10-13T16:20:55 Z |
codexistent |
Kas (COCI17_kas) |
C++14 |
|
157 ms |
524288 KB |
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define MAXN 505
#define MAXS 200005
#define FOR(i, a, b) for(ll i = a; i <= b; i++)
ll n, dp[MAXN][MAXS], s = 0;
int main(){
cin >> n;
FOR(i, 0, n) FOR(j, 0, 200000) dp[i][j] = MAXS;
dp[0][100000] = 0;
FOR(i, 1, n){
int x; cin >> x;
s += x;
FOR(j, x, 200000 - x){
dp[i][j - x] = min(dp[i][j - x], dp[i - 1][j]);
dp[i][j + x] = min(dp[i][j + x], dp[i - 1][j]);
dp[i][j] = min(dp[i][j], dp[i - 1][j] + x);
}
}
cout << ((s - dp[n][100000]) / 2 + dp[n][100000]) << endl;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
7 ms |
19028 KB |
Output is correct |
2 |
Correct |
7 ms |
19028 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
19028 KB |
Output is correct |
2 |
Correct |
6 ms |
19028 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
19028 KB |
Output is correct |
2 |
Correct |
7 ms |
21076 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
10 ms |
21076 KB |
Output is correct |
2 |
Correct |
8 ms |
23124 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
8 ms |
23124 KB |
Output is correct |
2 |
Correct |
8 ms |
23188 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
19 ms |
57940 KB |
Output is correct |
2 |
Correct |
23 ms |
66132 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
26 ms |
74504 KB |
Output is correct |
2 |
Correct |
28 ms |
80648 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
99 ms |
316492 KB |
Output is correct |
2 |
Correct |
130 ms |
394572 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
157 ms |
472580 KB |
Output is correct |
2 |
Runtime error |
75 ms |
524288 KB |
Execution killed with signal 9 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
73 ms |
524288 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |