#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);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
39 ms |
364 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
72 ms |
364 KB |
Output is partially correct |
2 |
Partially correct |
87 ms |
364 KB |
Output is partially correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
804 ms |
364 KB |
Output is partially correct |
2 |
Halted |
0 ms |
0 KB |
- |