Submission #861584

# Submission time Handle Problem Language Result Execution time Memory
861584 2023-10-16T13:54:54 Z aykhn CONSUL (info1cup19_consul) C++14
100 / 100
10 ms 700 KB
#include "grader.h"
#include <bits/stdc++.h>
 
// author : aykhn
 
using namespace std;
typedef long long ll;
 
#define pb push_back
#define ins insert
#define mpr make_pair
#define all(v) v.begin(), v.end()
#define bpc __builtin_popcount
#define pii pair<int, int>
#define pll pair<ll, ll>
#define fi first
#define se second
#define infll 0x3F3F3F3F3F3F3F3F
#define inf 0x3F3F3F3F

int n;
vector<int> v;
int l;
int c = 0;

void solve(int N)
{
    srand(time(0));
    n = N;
    v.assign(n + 1, 0);
    l = 60;
    c = 0;
    int 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 y = kth(x);
        int cc = cnt(y);
        if (cc*3 > n) 
        {
            ans = y;
            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 8 ms 344 KB Output is correct
2 Correct 2 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 8 ms 696 KB Output is correct
2 Correct 9 ms 440 KB Output is correct
3 Correct 3 ms 436 KB Output is correct
4 Correct 4 ms 444 KB Output is correct
5 Correct 9 ms 440 KB Output is correct
6 Correct 9 ms 432 KB Output is correct
7 Correct 8 ms 436 KB Output is correct
8 Correct 10 ms 696 KB Output is correct
9 Correct 9 ms 696 KB Output is correct
10 Correct 9 ms 700 KB Output is correct
11 Correct 10 ms 500 KB Output is correct
12 Correct 9 ms 700 KB Output is correct
13 Correct 10 ms 700 KB Output is correct
14 Correct 8 ms 440 KB Output is correct