Submission #89248

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
892482018-12-11 06:06:49zoomswkThe Big Prize (IOI17_prize)C++17
97.61 / 100
58 ms628 KiB
#include "prize.h"
#include <vector>
#include <algorithm>
using namespace std;
int m, res;
bool flag = false;
void solve(int l, int r, int num, int bef){
if(num == 0) return;
if(l > r) return;
int mid = (l+r)/2;
vector<int> resp = ask(mid);
if(resp[0]+resp[1] == 0){
res = mid;
flag = true;
return;
}
int b = mid;
while(resp[0]+resp[1] != m && b < r){
b++;
resp = ask(b);
if(resp[0]+resp[1] == 0){
res = b;
flag = true;
return;
}
}
if(resp[0]+resp[1] == m){
solve(l, mid-1, resp[0]-(b-mid)-bef, bef);
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...