# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
415161 | Bill_00 | The Big Prize (IOI17_prize) | C++14 | 3 ms | 1856 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 <bits/stdc++.h>
using namespace std;
int l[200005],r[200005],answer=-1;
int sum[2000005],n;
void update(int id,int L,int R,int x){
if(L==R){
sum[id]=1;
return;
}
int m=(L+R)>>1;
if(x>=m) update(id*2,L,m,x);
else update(id*2+1,m+1,R,x);
sum[id]=sum[id*2]+sum[id*2+1];
}
int query(int id,int L,int R,int LL,int RR){
if(RR<L || R<LL) return 0;
if(LL<=L && R<=RR) return sum[id];
int m=(L+R)>>1;
return query(id*2,L,m,LL,RR)+query(id*2+1,m+1,R,LL,RR);
}
int find(int id,int L,int R,int x){
if(L==R) return L;
int m=(L+R)>>1;
if(x<=sum[id*2]) return find(id*2,L,m,x);
else return find(id*2+1,m+1,R,x-sum[id*2]);
}
void solve(int L,int R){
if(answer!=-1) return;
if(L+1>=R){
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |