# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
448250 | JovanB | 도넛 (JOI14_ho_t3) | C++17 | 79 ms | 4468 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>
using namespace std;
typedef long long ll;
typedef long double ld;
ll pre[200005];
int lp, rp;
ll ternary(int l, int r){
if(r-l <= 3){
ll mn = 1e18;
for(int i=l; i<=r; i++){
ll x = abs(pre[i]-pre[lp-1]-(pre[rp]-pre[i]));
mn = min(mn, x);
}
return (pre[rp]-pre[lp-1]-mn)/2;
}
int a = l + (r-l)/3;
int b = r - (r-l)/3;
ll a1 = abs(pre[a]-pre[lp-1]-(pre[rp]-pre[a]));
ll b1 = abs(pre[b]-pre[lp-1]-(pre[rp]-pre[b]));
if(a1 == b1) return ternary(a, b);
if(a1 < b1) return ternary(l, b);
if(a1 > b1) return ternary(a, r);
}
ll a[200005];
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... |