# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
903461 | JakobZorz | The Big Prize (IOI17_prize) | C++17 | 65 ms | 2780 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"prize.h"
#include<iostream>
#include<vector>
#include<set>
using namespace std;
bool dpt[200000];
pair<int,int>dp[200000];
int n;
void query(int i){
if(dpt[i])
return;
dpt[i]=true;
auto res=ask(i);
dp[i]={res[0],res[1]};
int c=i+1;
while(c<n){
if(dpt[c]){
if(dp[c]==dp[i]){
//cout<<"filling segment "<<i<<" "<<c<<"\n";
for(int j=i+1;j<c;j++){
dp[j]=dp[i];
dpt[j]=true;
}
}
break;
}
c++;
}
}
void fo(int l,int r){
if(l==r)
return;
int m=(l+r)/2;
query(m);
if(l<r-1){
fo(l,m);
fo(m+1,r);
}
}
int find_best(int N){
n=N;
fo(0,n);
for(int i=0;i<n;i++)
if(dp[i].first+dp[i].second==0)
return i;
return -1;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |