# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1119611 | thangdz2k7 | CONSUL (info1cup19_consul) | C++17 | 2 ms | 448 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
// author : thembululquaUwU
// 3.9.2024
#include <bits/stdc++.h>
#include "grader.h"
#define pb push_back
#define fi first
#define se second
#define endl '\n'
using namespace std;
using ll = long long;
using ii = pair <int, int>;
using vi = vector <int>;
const int N = 1e6;
const int mod = 1e9 + 7;
void maxl(auto &a, auto b) {a = max(a, b);}
void minl(auto &a, auto b) {a = min(a, b);}
mt19937_64 rd(chrono::steady_clock::now().time_since_epoch().count());
#define rand rd
int num[N * 2];
void solve(int n){
srand(time(NULL));
vector <int> ap;
int can = 0;
for (int loops = 1; loops < min(60, n); ++ loops){
int i = rd() % n + 1;
int v = kth(i);
ap.push_back(v);
num[v] ++;
if (num[can] < num[v]) can = v;
}
for (int v : ap) num[v] = 0;
if (cnt(can) * 3 >= n){
say_answer(can);
}
else say_answer(-1);
}
//int main(){
// if (fopen("pqh.inp", "r")){
// freopen("pqh.inp", "r", stdin);
// freopen("pqh.out", "w", stdout);
// }
// ios_base::sync_with_stdio(0);
// cin.tie(0); cout.tie(0);
//
// int t = 1; // cin >> t;
// while (t --) solve();
// return 0;
//}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |