# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
89166 | 2018-12-10T20:41:43 Z | igzi | The Big Prize (IOI17_prize) | C++17 | 4 ms | 1892 KB |
#include <bits/stdc++.h> #include "prize.h" #define maxN 200002 using namespace std; int i,x=0,b[2][maxN]; vector <int> v,a; vector <int> ask1(int n){ if(b[0][n]!=-1) return ask(n); vector<int> ans; ans.push_back(b[0][n]); ans.push_back(b[1][n]); return ans; } int find_best(int n){ for(i=0;i<n;i++){ b[0][i]=b[1][i]=-1; } for(i=0;i*i<=n;i++){ a=ask1(i); if(a[0]+a[1]>x) x=a[0]+a[1]; if(a[0]+a[1]==0) return i; } int p=-1; for(int i=0;i<x;i++){ int l,d,m; l=p+1; d=n-x+i; while(l<d){ m=(l+d)/2; a=ask1(m); if(a[0]+a[1]==x){ if(a[0]-v.size()>0) d=m-1; else l=m+1; } else{ d=m; } } v.push_back(l); p=l; } for(i=0;i<v.size();i++){ a=ask1(v[i]); if(a[0]+a[1]==0) return v[i]; } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 4 ms | 1784 KB | Integer 200704 violates the range [0, 199999] |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 1892 KB | Integer 200704 violates the range [0, 199999] |
2 | Halted | 0 ms | 0 KB | - |