Submission #540654

# Submission time Handle Problem Language Result Execution time Memory
540654 2022-03-21T10:38:23 Z Carmel_Ab1 CONSUL (info1cup19_consul) C++17
100 / 100
27 ms 336 KB
#include "grader.h"
#include "bits/stdc++.h"

void solve(int n){
    std::vector<int>ord(n);
    for(int i=0; i<n; i++)
        ord[i]=i+1;

    std::mt19937 rng(std::chrono::steady_clock::now().time_since_epoch().count());
    std::shuffle(ord.begin(),ord.end(),rng);

    int limit=std::min(n,(n<=50?25:30));
    for(int i=0; i<limit; i++){
        int v=kth(ord[i]);
        int c=cnt(v);
        if(c>n/3) {
            say_answer(v);
            return;
        }
    }
    say_answer(-1);
}
# Verdict Execution time Memory Grader output
1 Correct 11 ms 208 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 18 ms 208 KB Output is correct
2 Correct 8 ms 208 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 22 ms 304 KB Output is correct
2 Correct 25 ms 208 KB Output is correct
3 Correct 7 ms 208 KB Output is correct
4 Correct 7 ms 208 KB Output is correct
5 Correct 26 ms 304 KB Output is correct
6 Correct 23 ms 208 KB Output is correct
7 Correct 23 ms 208 KB Output is correct
8 Correct 24 ms 208 KB Output is correct
9 Correct 12 ms 308 KB Output is correct
10 Correct 16 ms 308 KB Output is correct
11 Correct 26 ms 208 KB Output is correct
12 Correct 25 ms 336 KB Output is correct
13 Correct 27 ms 208 KB Output is correct
14 Correct 14 ms 308 KB Output is correct