Submission #950125

# Submission time Handle Problem Language Result Execution time Memory
950125 2024-03-20T05:37:22 Z pcc CONSUL (info1cup19_consul) C++17
0 / 100
1 ms 444 KB
#include "grader.h"
#include <bits/stdc++.h>
using namespace std;
/*
/// insert your code
/// for example
if(cnt(kth(1)) > n / 3) say_answer(kth(1));
	else say_answer(-1);

*/

map<int,int> kmp,cmp;

int get_idx(int p){
	if(kmp.find(p) != kmp.end())return kmp[p];
	else return kmp[p] = kth(p);
}
int get_cnt(int k){
	if(cmp.find(k) != cmp.end())return cmp[k];
	else return cmp[k] = cnt(k);
}

void solve(int N){
	vector<int> v;
	for(int i = 1;i<=N;i++)v.push_back(i);
	srand(time(NULL));
	random_shuffle(v.begin(),v.end());
	for(int i = 0;i<25;i++){
		int now = v[i];
		if(get_cnt(get_idx(now))>N/3){
			say_answer(get_idx(now));
		}
	}
	say_answer(-1);
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB Multiple answers provided for the same testcase!
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Multiple answers provided for the same testcase!
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 444 KB Wrong answer
2 Halted 0 ms 0 KB -