제출 #1043003

#제출 시각아이디문제언어결과실행 시간메모리
1043003Mr_Husanboy커다란 상품 (IOI17_prize)C++17
20 / 100
24 ms428 KiB
#include "prize.h" #include <bits/stdc++.h> using namespace std; #define ll long long #define ff first #define ss second #define all(a) (a).begin(), (a).end() template<typename T> int len(T &a){ return a.size(); } int find_best(int n) { // if(n <= 5000){ // for(int i = 0; i < n; i ++){ // if(ask(i) == vector<int>{0, 0}){ // return i; // } // } // } int j = 0; int rig = 0; while(true){ auto v = ask(j); if(v[0] + v[1] == 0){ return j; } if(n - v[0] + v[1] > n / 2){ rig = v[1]; break; } j ++; } // for(int i = 0; i < 100; i++){ // cout << "2 "; // }cout << "1" << endl; // cout << j << endl; while(true){ int l = j, r = n; while(r - l > 1){ int m = (l + r) / 2; vector<int> v = ask(m); if(v[0] + v[1] == 0){ return m; } if(v[1] == rig){ l = m; }else r = m; } j = r + 1; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...