Submission #246294

#TimeUsernameProblemLanguageResultExecution timeMemory
246294lovemathboyCONSUL (info1cup19_consul)C++14
85 / 100
69 ms416 KiB
#include <bits/stdc++.h> #include "grader.h" using namespace std; void solve(int n) { vector<int> r; for (int i = 1; i <= n; i++) r.push_back(i); random_shuffle(r.begin(), r.end()); map<int, int> m; set<int> s; for (int i = 0; i < min(n, 49); i++) { int val = kth(r[i]); m[val]++; s.insert(val); } vector<pair<int, int> > totals; for (int i: s) { totals.emplace_back(-m[i], i); } sort(totals.begin(), totals.end()); for (int i = 0; i < min((int)totals.size(), 10); i++) { if (cnt(totals[i].second) > n/3) { say_answer(totals[i].second); return; } } say_answer(-1); return; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...