Submission #500316

#TimeUsernameProblemLanguageResultExecution timeMemory
500316MohamedFaresNebiliThe Big Prize (IOI17_prize)C++14
0 / 100
1 ms284 KiB
#include <bits/stdc++.h>
#include "prize.h"

        using namespace std;

        using ll = long long;
        using ii = pair<ll, ll>;
        using vi = vector<ll>;

        #define ff first
        #define ss second
        #define pb push_back
        #define all(x) x.begin(), x.end()
        #define lb lower_bound
        #define ub upper_bound

        int find_best(int n) {
            int lo = 0, hi = n - 1;
            while(lo <= hi) {
                int md = (lo + hi) / 2;
                vector<int> res = ask(md);
                if(res[0] + res[1] == 0) return md;
                if(res[0] > res[1] && md != n - 1) lo = md + 1;
                else if(res[0] < res[1] && md != 0) hi = md - 1;
                if(md == 0) lo = md + 1;
                else if(md == n - 1) hi = md - 1;
            }
            return 0;
        }

#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...