# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
950127 |
2024-03-20T05:37:45 Z |
pcc |
CONSUL (info1cup19_consul) |
C++17 |
|
1 ms |
440 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));
return;
}
}
say_answer(-1);
return;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
344 KB |
Wrong answer |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
436 KB |
Wrong answer |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
440 KB |
Wrong answer |
2 |
Halted |
0 ms |
0 KB |
- |