Submission #206710

# Submission time Handle Problem Language Result Execution time Memory
206710 2020-03-04T16:59:36 Z mayhoubsaleh CONSUL (info1cup19_consul) C++14
0 / 100
6 ms 380 KB
#include "grader.h"
#include <bits/stdc++.h>
using namespace std;
void solve(int n)
{
    bool vis[1010];
    memset(vis,0,sizeof vis);
    int x=min(n-1,59);
    map<int,int>res;
    while(x--){
        int id=rand()%n+1;
        if(vis[id]){x++;continue;}
        vis[id]=1;
        int val=kth(id);
        res[val]++;
        if(res[val]>n/3){
            say_answer(val);
            return;
        }
 
    }
    pair<int,int>mx={-1,-1};
    for(auto x:res){
        if(x.second>mx.second){
            mx=x;
        }
    }
    if(cnt(mx.first)>n/3){
        say_answer(mx.second);
        return ;
    }
    say_answer(-1);
}
# Verdict Execution time Memory Grader output
1 Incorrect 6 ms 248 KB Wrong answer
# Verdict Execution time Memory Grader output
1 Incorrect 6 ms 380 KB Wrong answer
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 6 ms 248 KB Wrong answer
2 Halted 0 ms 0 KB -