Submission #1210018

#TimeUsernameProblemLanguageResultExecution timeMemory
1210018PlayVoltzCONSUL (info1cup19_consul)C++20
100 / 100
8 ms412 KiB
#include "grader.h"
//#include "grader.cpp"
#include <bits/stdc++.h>
using namespace std;

//#define int long long 
//#define ld long double
#define show(x,y) cout << y << " " << #x << endl;
#define show2(x,y,i,j) cout << y << " " << #x << "  " << j << " " << #i << endl;
#define show3(x,y,i,j,p,q) cout << y << " " << #x << "  " << j << " " << #i << "  " << q << " " << #p << endl;
#define show4(x,y) for(auto it:y) cout << it << " "; cout << #x << endl;
typedef pair<int,int>pii;
//typedef pair<ld,ld>pi2;
mt19937_64 rng(chrono::system_clock::now().time_since_epoch().count());
int ran(int index){return rng()%index;}

//say_answer()
//cnt()
//kth()

void solve(int n){
	vector<int>v;
	for(int x=1;x<=n;x++){
		v.push_back(x);
	}
	
	random_shuffle(v.begin(),v.end(),ran);
	
	int need=30;
	if(n<=50) need=25;
	
	for(int x=0;x<need;x++){
		int hold=kth(v[x]);
		int hold2=cnt(hold);
		if(hold2*3>n){
			say_answer(hold);
			return;
		}
	}
	say_answer(-1);
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...