Submission #315016

# Submission time Handle Problem Language Result Execution time Memory
315016 2020-10-22T00:35:08 Z 2qbingxuan CONSUL (info1cup19_consul) C++14
100 / 100
25 ms 512 KB
#include "grader.h"
#include <bits/stdc++.h>
#ifdef local
#define debug(args...) qqbx(#args, args)
template <typename ...T> void qqbx(const char *s, T ...args) {
    int cnt = sizeof...(T);
    (std::cerr << "(" << s << ") = (" , ... ,
         (std::cerr << args << (--cnt ? ", " : ")\n")));
}
#else
#define debug(...) ((void)0)
#endif // local
#define pb emplace_back
#define all(v) begin(v), end(v)
using namespace std;

void solve(int n)
{
    /// insert your code
    /// for example
    vector<int> p(n);
    iota(all(p), 1);
    mt19937 rng(7122);
    shuffle(all(p), rng);
    for(int i = 0; i < 25 && i < n; i++) {
        int x = kth(p[i]);
        if(cnt(x) > n / 3) {
            say_answer(x);
            return;
        }
    }
    say_answer(-1);
}
# Verdict Execution time Memory Grader output
1 Correct 10 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 16 ms 256 KB Output is correct
2 Correct 12 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 22 ms 256 KB Output is correct
2 Correct 22 ms 384 KB Output is correct
3 Correct 10 ms 384 KB Output is correct
4 Correct 12 ms 256 KB Output is correct
5 Correct 20 ms 384 KB Output is correct
6 Correct 23 ms 384 KB Output is correct
7 Correct 22 ms 384 KB Output is correct
8 Correct 24 ms 384 KB Output is correct
9 Correct 23 ms 384 KB Output is correct
10 Correct 24 ms 384 KB Output is correct
11 Correct 24 ms 512 KB Output is correct
12 Correct 19 ms 384 KB Output is correct
13 Correct 25 ms 384 KB Output is correct
14 Correct 25 ms 256 KB Output is correct