Submission #1043004

# Submission time Handle Problem Language Result Execution time Memory
1043004 2024-08-03T17:35:55 Z Mr_Husanboy The Big Prize (IOI17_prize) C++17
20 / 100
49 ms 596 KB
#include "prize.h"
#include <bits/stdc++.h>

using namespace std;

#define ll long long
#define ff first
#define ss second
#define all(a) (a).begin(), (a).end()

template<typename T>
int len(T &a){
	return a.size();
}

int find_best(int n) {
	// if(n <= 5000){
	// 	for(int i = 0; i < n; i ++){
	// 		if(ask(i) == vector<int>{0, 0}){
	// 			return i;
	// 		}
	// 	}
	// }
	int j = 0;
	int rig = 0;
	while(true){
		auto v = ask(j);
		if(v[0] + v[1] == 0){
			return j;
		}
		if(n - v[0] + v[1] > n / 2){
			rig = v[1];
			break;
		}
		j ++;
		rig --;
	}
	// for(int i = 0; i < 100; i++){
	// 	cout << "2 ";
	// }cout << "1" << endl;
	// cout << j << endl;
	while(true){
		int l = j, r = n;
		while(r - l > 1){
			int m = (l + r) / 2;
			vector<int> v = ask(m);
			if(v[0] + v[1] == 0){
				return m;
			}
			if(v[1] == rig){
				l = m;
			}else r = m;
		}
		j = r + 1;
	}
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 596 KB Output is correct
4 Correct 1 ms 592 KB Output is correct
5 Correct 1 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 344 KB Output is correct
9 Correct 0 ms 428 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 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 1 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 Incorrect 49 ms 344 KB Incorrect
12 Halted 0 ms 0 KB -