Submission #523155

# Submission time Handle Problem Language Result Execution time Memory
523155 2022-02-07T06:51:15 Z reni CONSUL (info1cup19_consul) C++14
100 / 100
29 ms 204 KB
#include "grader.h"
#include<unordered_map>
#include <stdlib.h>
#include<time.h>
#include<iostream>
using namespace std;

void solve(int n)
{
    unordered_map<long long, int>mp;

    srand (time(0));
    int br=0;
    if(n<=50)br=10;
    
    for(int i=1;i<=60;i++)
    {
        if(br>58)break;
        long long pos=rand()%n+1;
        long long val=kth(pos);br++;

        if(mp.count(val))continue;
        mp[val]=1;
            br++;
         if(cnt(val) > n / 3){say_answer(val);return;}
    }
        say_answer(-1);return;
}
# Verdict Execution time Memory Grader output
1 Correct 10 ms 200 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 20 ms 204 KB Output is correct
2 Correct 5 ms 200 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 19 ms 200 KB Output is correct
2 Correct 20 ms 200 KB Output is correct
3 Correct 5 ms 200 KB Output is correct
4 Correct 7 ms 200 KB Output is correct
5 Correct 22 ms 200 KB Output is correct
6 Correct 26 ms 200 KB Output is correct
7 Correct 26 ms 200 KB Output is correct
8 Correct 29 ms 200 KB Output is correct
9 Correct 20 ms 200 KB Output is correct
10 Correct 25 ms 200 KB Output is correct
11 Correct 22 ms 200 KB Output is correct
12 Correct 17 ms 200 KB Output is correct
13 Correct 27 ms 200 KB Output is correct
14 Correct 25 ms 200 KB Output is correct