Submission #415161

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
4151612021-05-31 15:28:11Bill_00The Big Prize (IOI17_prize)C++14
0 / 100
3 ms1856 KiB
#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){
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

prize.cpp: In function 'int find_best(int)':
prize.cpp:63:6: warning: unused variable 'm' [-Wunused-variable]
   63 |  int m=(n-1)/2;
      |      ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...