Submission #970420

#TimeUsernameProblemLanguageResultExecution timeMemory
97042012345678CONSUL (info1cup19_consul)C++17
85 / 100
29 ms712 KiB
#include "grader.h" #include <bits/stdc++.h> using namespace std; mt19937 rng(time(0)); void solve(int n) { vector<pair<int, int>> v; map<int, int> mp; for (int i=1; i<=n; i++) v.push_back({rng(), i}); sort(v.begin(), v.end()); for (int i=1; i<=min(n, 57); i++) mp[kth(v[i-1].second)]++; priority_queue<pair<int, int>> pq; for (auto [x, y]:mp) pq.push({y, x}); if (!pq.empty()&&cnt(pq.top().second)>(n/3)) return say_answer(pq.top().second),void(); if (!pq.empty()) pq.pop(); if (!pq.empty()&&cnt(pq.top().second)>(n/3)) return say_answer(pq.top().second),void(); if (!pq.empty()) pq.pop(); if (!pq.empty()&&cnt(pq.top().second)>(n/3)) return say_answer(pq.top().second),void(); if (!pq.empty()) pq.pop(); say_answer(-1); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...