Submission #1100370

#TimeUsernameProblemLanguageResultExecution timeMemory
1100370codexistentKas (COCI17_kas)C++14
80 / 100
157 ms524288 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...