#include "grader.h"
#include <map>
using namespace std;
map < int , int > all;
void solve(int n)
{
all.clear();
int i,t,big=0,xx=n,x;
if(n<=50)
{
for(i=1;i<=n;i++)
{
t=kth(i);
all[t]++;
big=max(big,all[t]);
if(all[t]>n/3)
{
say_answer(t);
return;
}
if(big+(n-i)<=n/3)
{
say_answer(-1);
return;
}
}
say_answer(-1);
}
else
{
for(i=1;i<=n/3*2+10;i++)
{
t=kth(i);
all[t]++;
if(all[t]==10)
{
x=cnt(t);
big=max(big,x);
xx-=(x-10);
}
if(big>n/3)
{
say_answer(t);
return;
}
}
say_answer(-1);
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
35 ms |
256 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
41 ms |
256 KB |
Output is partially correct |
2 |
Partially correct |
34 ms |
256 KB |
Output is partially correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
182 ms |
384 KB |
Output is partially correct |
2 |
Halted |
0 ms |
0 KB |
- |