Submission #70112

# Submission time Handle Problem Language Result Execution time Memory
70112 2018-08-22T11:13:46 Z E869120 The Big Prize (IOI17_prize) C++14
0 / 100
7 ms 2696 KB
#include "prize.h"
#include <bits/stdc++.h>
using namespace std;

vector<int>vec;

int find_best(int n) {
	// -------------- 前処理 -----------------
	for(int i=0;i<n;i++) vec.push_back(i);
	
	while(vec.size() >= 2){
		int maxn=0;
		for(int i=0;i<30;i++){
			vector<int>P = ask(vec[rand()%vec.size()]);
			maxn = max(maxn, P[0] + P[1]);
		}
		assert(maxn==(int)vec.size());
		vector<int>vec2; int ret = -1;
		for(int h=0;h<maxn;h++){
			int cx = 0;
			for(int i=17;i>=0;i--){
				int pos = cx + (1 << i) - 1; if(pos >= (int)vec.size()) pos = vec.size() - 1;
				vector<int>L = ask(vec[pos]);
				if((L[0] + L[1] == maxn && L[0] == h) || pos <= ret) cx += (1 << i);
			}
			if(cx == 262143) cx = vec.size() - 1;
			assert(cx >= 0 && cx < (int)vec.size());
			vec2.push_back(vec[cx]); ret = cx;
		}
		vec = vec2;
	}
	return vec[0];
}
# Verdict Execution time Memory Grader output
1 Runtime error 7 ms 2408 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 5 ms 2696 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -