This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
int kth(int k);
void say_answer(int k);
int cnt(int k);
void solve(int n) {
map<int, int> mp;
int sum = 0;
for (int i = 1; i <= n; i++) {
int k1 = kth(i);
if (!mp[k1]) {
int k2 = cnt(k1);
mp[k1] += k2;
if (k2 > n / 3) {
say_answer(k1);
return;
}
sum += k2;
}
if (sum >= (n / 3) * 2) {
say_answer(-1);
return;
}
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |