# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
989463 | khanhtb | Split the sequence (APIO14_sequence) | C++14 | 52 ms | 131072 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define ld double
#define pb push_back
#define pf push_front
#define vi vector<ll>
#define vii vector<vi>
#define pll pair<ll,ll>
#define vpll vector<pll>
#define all(a) a.begin(), a.end()
#define fi first
#define se second
using namespace std;
const ll mod = 1e9+7;
const ll inf = 1e18;
const ll base = 31;
const ll blocksz = 320;
const ll N = 1e5+8;
ll pre[N],pre2[N],n,a[N],dp[N][208],k,trace[N][20];
ll cost(ll l, ll r){
return ((pre[r]-pre[l-1])*(pre[r]-pre[l-1])-(pre2[r]-pre2[l-1]))/2;
}
void dnc(ll l, ll r, ll optl, ll optr, ll j){
if(l > r) return;
ll m = l+r>>1;
pll best = {inf,-1};
for(ll i = optl; i <= min(m,optr); i++){
best = min(best,{dp[i][j-1]+cost(i+1,m),i});
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |