제출 #96377

#제출 시각아이디문제언어결과실행 시간메모리
96377figter001커다란 상품 (IOI17_prize)C++14
0 / 100
9 ms9596 KiB
#include "prize.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; const int maxn = 2e5+50; int ans,n; map<int,vector<int>> mp[maxn]; void solve(int l,int r){ if(l > r || ans != -1)return; int md = (l+r)/2; vector<int> res = ask(md); if(res[0] + res[1] == 0){ ans = md; return; } int sum = res[0] + res[1]; auto it = mp[sum].upper_bound(md); if(it != mp[sum].end()){ if((*it).second[0] != res[0]) solve(md+1,r); } if(it != mp[sum].begin()){ it--; if(it->second[1] != res[1]) solve(l,md-1); } mp[sum][md] = res; } int find_best(int N) { srand(time(0)); n = N; ans = -1; solve(0,n-1); return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...