답안 #1055354

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1055354 2024-08-12T18:01:09 Z phoenix 커다란 상품 (IOI17_prize) C++17
20 / 100
56 ms 5460 KB
#include "prize.h"
#include <bits/stdc++.h>

using namespace std;

const int N = 200200;

vector<int> arr[N];

vector<int> ASK(int p) {
	if (arr[p].empty())
		arr[p] = ask(p);
	return arr[p];	
}

int find_best(int n) {
	int i = 0;
	while (i < n) {
		int x = ASK(i)[0] + ASK(i)[1];
		if (!x) 
			return i;
		
		if (false)
			i++;
		else {
			int l = i, r = n;
			while (r - l > 1) {
				int m = (l + r) / 2;
				if (ASK(m) == ASK(l))
					l = m;
				else {
					if (ASK(m)[0] + ASK(m)[1] == 0) 
						return m;
					r = m;
				} 
			}
			i = r;
		}
	}
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 4952 KB Output is correct
2 Correct 1 ms 4952 KB Output is correct
3 Correct 1 ms 4952 KB Output is correct
4 Correct 1 ms 4952 KB Output is correct
5 Correct 1 ms 4952 KB Output is correct
6 Correct 2 ms 4952 KB Output is correct
7 Correct 1 ms 4952 KB Output is correct
8 Correct 1 ms 4952 KB Output is correct
9 Correct 1 ms 4952 KB Output is correct
10 Correct 1 ms 4952 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 4952 KB Output is correct
2 Correct 1 ms 4952 KB Output is correct
3 Correct 1 ms 4952 KB Output is correct
4 Correct 1 ms 4952 KB Output is correct
5 Correct 1 ms 4952 KB Output is correct
6 Correct 1 ms 4952 KB Output is correct
7 Correct 1 ms 4952 KB Output is correct
8 Correct 1 ms 5132 KB Output is correct
9 Correct 1 ms 4952 KB Output is correct
10 Correct 1 ms 4952 KB Output is correct
11 Correct 3 ms 4952 KB Output is correct
12 Correct 1 ms 5128 KB Output is correct
13 Correct 5 ms 4952 KB Output is correct
14 Correct 3 ms 4952 KB Output is correct
15 Correct 9 ms 5388 KB Output is correct
16 Incorrect 56 ms 5460 KB Incorrect
17 Halted 0 ms 0 KB -