Submission #1036224

#TimeUsernameProblemLanguageResultExecution timeMemory
1036224Alihan_8커다란 상품 (IOI17_prize)C++17
20 / 100
52 ms432 KiB
#include "prize.h"

#include <bits/stdc++.h>

using namespace std;

#define all(x) x.begin(), x.end()
#define ar array
#define pb push_back
#define ln '\n'
//#define int long long

using i64 = long long;

template <class F, class _S>
bool chmin(F &u, const _S &v){
    bool flag = false;
    if ( u > v ){
        u = v; flag |= true;
    }
    return flag;
}

template <class F, class _S>
bool chmax(F &u, const _S &v){
    bool flag = false;
    if ( u < v ){
        u = v; flag |= true;
    }
    return flag;
}

int find_best(int n){
	for ( int i = n - 1; i >= 0; i-- ){
		auto c = ask(i);
		
		if ( c[0] + c[1] == 0 ){
			return i;
		}
		
		int l = 0, r = i;
		
		while ( l < r ){
			int m = (l + r) / 2;
			
			if ( ask(m) != c ){
				l = m + 1;
			} else r = m;
		}
		
		i = l;
	}
	
	assert(false);
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...