Submission #1089793

# Submission time Handle Problem Language Result Execution time Memory
1089793 2024-09-17T07:09:08 Z LilPluton CONSUL (info1cup19_consul) C++14
100 / 100
16 ms 856 KB
#include "grader.h"
#include <bits/stdc++.h>
using namespace std;

int n;
vector<int>v;
int l, c = 0, ans;
void solve(int N){
    n = N;
    v.assign(n + 1, 0);
    l = 60;
    c = 0;
    ans = -1;
    while(l && c * 2 <= n){
        l--;
        if(!l){
            return;
        }
        int x = rand() % n + 1;
        while(v[x]){
            x = rand() % n + 1;
        }
        v[x] = 1;
        int u = kth(x);
        int cc = cnt(u);
        if(cc * 3 > n){
            ans = u;break;
        }
        ++c;
        l--;
    }
    say_answer(ans);
}
# Verdict Execution time Memory Grader output
1 Correct 4 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 11 ms 340 KB Output is correct
2 Correct 3 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 344 KB Output is correct
2 Correct 11 ms 344 KB Output is correct
3 Correct 4 ms 344 KB Output is correct
4 Correct 3 ms 600 KB Output is correct
5 Correct 10 ms 448 KB Output is correct
6 Correct 12 ms 344 KB Output is correct
7 Correct 9 ms 344 KB Output is correct
8 Correct 8 ms 344 KB Output is correct
9 Correct 10 ms 344 KB Output is correct
10 Correct 14 ms 440 KB Output is correct
11 Correct 9 ms 344 KB Output is correct
12 Correct 14 ms 856 KB Output is correct
13 Correct 16 ms 344 KB Output is correct
14 Correct 10 ms 344 KB Output is correct