제출 #977379

#제출 시각아이디문제언어결과실행 시간메모리
977379mariaclaraThe Big Prize (IOI17_prize)C++17
20 / 100
3043 ms2132 KiB
#include "prize.h" #include<bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int,int> pii; #define all(x) x.begin(), x.end() #define sz(x) (int)x.size() #define mk make_pair #define pb push_back #define fr first #define sc second int find_best(int n) { int i = 0, at = 0; vector<pii> resp(n, mk(-1,-1)); while(1) { // achar primeiro cara mais valioso doq um pirulito de indice maior que i int l = i, r = n-1; while(l <= r) { int mid = (l+r)/2; vector<int> aux; if(resp[mid] == mk(-1,-1)) aux = ask(mid), resp[mid] = {aux[0],aux[1]}; else aux = {resp[mid].fr}; if(aux[0] > at) r = mid-1; else l = mid+1; } at++; i = r; vector<int> aux; if(resp[i] == mk(-1,-1)) aux = ask(i), resp[i] = {aux[0], aux[1]}; else aux = {resp[i].fr, resp[i].sc}; if(aux[0] + aux[1] == 0) return i; i++; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...