# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
45699 | 2018-04-16T03:55:12 Z | Talant | Bali Sculptures (APIO15_sculpture) | C++17 | 2 ms | 836 KB |
#include <bits/stdc++.h> #define fr first #define sc second #define OK puts("OK"); #define pb push_back #define mk make_pair #define int long long using namespace std; typedef long long ll; const long long inf = (long long)1e18 + 7; const int N = (int)2e5 + 7; int n,a,b; long long ar[N],p[N]; long long dp[2002][2002]; long long mn = inf; int calc (int l,int r) { return (p[r] - p[l - 1]); } main () { scanf ("%lld%lld%lld", &n,&a,&b); for (int i = 1; i <= n; i ++) for (int j = 1; j <= b; j ++) dp[i][j] = inf; for (int i = 1; i <= n; i ++) { scanf ("%lld", &ar[i]); p[i] = p[i - 1] + ar[i]; dp[i][1] = p[i]; } for (int i = 1; i <= n; i ++) { for (int j = 2; j <= b; j ++) { for (int l = 1; l < i; l ++) { dp[i][j] = min(dp[i][j],dp[l][j - 1] | calc(l + 1,i)); } } } for (int i = a; i <= b; i ++) mn = min(mn,dp[n][i]); cout << mn << endl; } /** 6 1 3 8 1 2 1 5 4 **/
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Incorrect | 2 ms | 564 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 564 KB | Output is correct |
2 | Incorrect | 2 ms | 588 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 588 KB | Output is correct |
2 | Incorrect | 2 ms | 588 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 600 KB | Output is correct |
2 | Incorrect | 2 ms | 604 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 648 KB | Output is correct |
2 | Incorrect | 2 ms | 836 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |