# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
155925 | 2019-10-02T03:57:10 Z | aloo123 | Bali Sculptures (APIO15_sculpture) | C++17 | 2 ms | 380 KB |
#include <bits/stdc++.h> #define ll long long #define ld long double #define f first #define s second #define mp make_pair #define pb push_back #define vll vector<ll> #define fastio ios_base::sync_with_stdio(0),cin.tie(NULL),cout.tie(NULL) using namespace std; const ll N = 3e5+100; const ll MOD = 1e9+7; int main() { fastio; ll n,a,b; cin >> n >>a >> b; ll arr[n+1]; ll pre[n+1]; for(int i = 1;i<=n;i++) cin >> arr[i]; pre[0] = 0; pre[1] = arr[1]; for(int i =2;i<=n;i+=1) pre[i] = pre[i-1] + arr[i]; ll dp[n+1][n+1]; for(int i =1;i<=(n);i++) for(int j =1;j<=n;j++) dp[i][j]=LLONG_MAX; for(int i = 0;i<=n;i++) { dp[i][0] = 0; dp[0][i]; } dp[1][1] = arr[1]; for(int i =2;i<=n;i++) { dp[i][1] = pre[i]; for(int x = 2;x<=i;x++) { for(int l = 1;l<i;l++) { dp[i][x] = min((dp[l][x-1] | (pre[i]-pre[l])),dp[i][x]); } } } ll ans =LLONG_MAX; for(int i=a;i<=b;i++) { ans=min(ans,dp[n][i]); } cout<<ans<<endl; return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Incorrect | 2 ms | 376 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Incorrect | 2 ms | 376 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Incorrect | 2 ms | 376 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Incorrect | 2 ms | 380 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Incorrect | 2 ms | 376 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |