답안 #936491

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
936491 2024-03-02T01:12:18 Z Ghetto 커다란 상품 (IOI17_prize) C++17
20 / 100
1 ms 544 KB
#include "prize.h"
#include <bits/stdc++.h>
using namespace std;

int n;

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

int find_best(int tmp_n) {
	n = tmp_n;

	int ans = bin_search();
	return ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 1 ms 428 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
9 Correct 1 ms 344 KB Output is correct
10 Correct 1 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 0 ms 344 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 0 ms 428 KB Output is correct
9 Correct 0 ms 544 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Incorrect 0 ms 344 KB answer is not correct
12 Halted 0 ms 0 KB -