Submission #582210

#TimeUsernameProblemLanguageResultExecution timeMemory
582210Koosha_mvThe Big Prize (IOI17_prize)C++14
20 / 100
97 ms336 KiB
#include "prize.h" #include <bits/stdc++.h> using namespace std; #define dbgv(v) cout<<#v<<" = "; f(i,0,v.size()) cout<<v[i]<<" "; cout<<endl #define dbga(a,x,y) cout<<#a<<" = "; f(i,x,y) cout<<a[i]<<" "; cout<<endl #define erorp(x) cout<<#x<<"={"<<x.F<<" , "<<x.S<<"}"<<endl #define eror(x) cout<<#x<<'='<<(x)<<endl #define f_(i,a,b) for(int i=a;i>=b;i--) #define f(i,a,b) for(int i=a;i<b;i++) #define nb(x) __builtin_popcount(x) #define all(v) v.begin(),v.end() #define bit(n,k) (((n)>>(k))&1) #define Add(x,y) x=(x+y)%mod #define maxm(a,b) a=max(a,b) #define minm(a,b) a=min(a,b) #define lst(x) x[x.size()-1] #define sz(x) int(x.size()) #define mp make_pair #define ll long long #define pb push_back #define S second #define F first mt19937 rng(time(nullptr)); int n,sum,mxc; int nxt(int x){ int l=0,r=n; while(l+1<r){ int mid=(l+r)>>1; vector<int> res=ask(mid); if(res[0]+res[1]<sum) return mid; } return 1; } int find_best(int _n){ n=_n; uniform_int_distribution<int> rnd(0,n-1); vector<int> res; f(i,0,min(n,120)){ int id=rnd(rng); res=ask(id); maxm(mxc,res[0]+res[1]); } f(i,0,n){ int prt=0; res=ask(i); prt=res[0]; if(res[0]+res[1]==0) return i; if(res[0]+res[1]<mxc){ continue ; } int l=i,r=n,mid; while(l+1<r){ mid=(l+r)>>1; res=ask(mid); if(res[0]+res[1]<mxc || prt<res[0]){ r=mid; } else{ l=mid; } } i=l; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...