# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
60712 | theknife2001 | Rice Hub (IOI11_ricehub) | C++17 | 38 ms | 14800 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 "ricehub.h"
#include <bits/stdc++.h>
using namespace std;
const int N=1e5+55;
long long sum[N];
long long pos[N];
int n;
bool ok(int x, long long b)
{
long long best,cur;
best=1e18+55;
for(int i=0;i<=n-x;i++)
{
cur=pos[x/2+i]*(x/2)-sum[i+x/2-1];
if(i)
cur+=sum[i-1];
cur+=sum[i+x-1]-sum[i+(x-1)/2]-pos[x/2+i]*(x/2);
// cur=0;
// for(int j=i;j<i+x;j++)
// {
// cur+=abs(pos[j]-pos[i+x/2]);
// }
best=min(best,cur);
}
if(best>b)
return 0;
# | 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... |