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>
#include "grader.h"
//#include "grader.cpp"
using namespace std;
void solve(int n)
{
int need=(n)/3;
vector<int>v;
for(int i=1; i <= n ; i++)
{
v.push_back(kth(i));
}
sort(v.begin(), v.end());
int cn=1 , ans=-1;
for(int i = 1 ; i<n ; i++)
{
if(v[i]==v[i-1])cn++;
else
{
if( cn>need)
{
ans=v[i-1];
cn=1;
break;
}
cn=1;
}
}
if( cn > need)
{
ans=v[n-1];
}
say_answer(ans);
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |