# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
363256 | denkendoemeer | Sparklers (JOI17_sparklers) | C++14 | 43 ms | 2924 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
const ll inf=1e18;
using namespace std;
ll t,x[100005],dp[100005];
int n,k;
bool calc(ll nr)
{
nr=nr*2;
if (t*nr>(ll)1e9)
return 1;
int i;
for(i=1;i<=n;i++)
dp[i]=x[i]-i*t*nr;
int st=1,dr=n;
for(i=1;i<=k;i++)
if (dp[st]<=dp[i])
st=i;
for(i=k;i<=n;i++)
if (dp[dr]>=dp[i])
dr=i;
int l=k,r=k;
ll v1=dp[l],v2=dp[r];
while(st<=l || r<=dr){
int auxl=l,auxr=r;
while(l>=st && dp[l]>=v2){
v1=max(v1,dp[l]);
l--;
}
while(r<=dr && dp[r]<=v1){
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... |