답안 #1036224

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1036224 2024-07-27T06:24:58 Z Alihan_8 커다란 상품 (IOI17_prize) C++17
20 / 100
52 ms 432 KB
#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);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 1 ms 344 KB Output is correct
8 Correct 1 ms 344 KB Output is correct
9 Correct 1 ms 344 KB Output is correct
10 Correct 0 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 1 ms 432 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 1 ms 344 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
10 Correct 0 ms 344 KB Output is correct
11 Correct 6 ms 344 KB Output is correct
12 Correct 4 ms 344 KB Output is correct
13 Correct 1 ms 344 KB Output is correct
14 Correct 20 ms 344 KB Output is correct
15 Partially correct 41 ms 344 KB Partially correct - number of queries: 6733
16 Correct 13 ms 344 KB Output is correct
17 Incorrect 52 ms 344 KB Incorrect
18 Halted 0 ms 0 KB -