#include "grader.h"
//#include "grader.cpp"
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
void solve(int n)
{
int x;
map<int,bool>mp;
int vis[1001]={0};
int cur=30;
bool ok=0;
while(cur--)
{
x=rand()%n+1;
if(vis[x]) continue;
vis[x]=1;
int y=kth(x);
if(!mp[y])
{
mp[y]=1;
if(cnt(y)>n/3)
{
ok=1;
say_answer(y);
break;
}
}
}
if(!ok) say_answer(-1);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
364 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
16 ms |
364 KB |
Output is correct |
2 |
Correct |
7 ms |
364 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
16 ms |
364 KB |
Output is correct |
2 |
Correct |
19 ms |
364 KB |
Output is correct |
3 |
Correct |
6 ms |
364 KB |
Output is correct |
4 |
Correct |
6 ms |
364 KB |
Output is correct |
5 |
Correct |
15 ms |
364 KB |
Output is correct |
6 |
Correct |
20 ms |
364 KB |
Output is correct |
7 |
Correct |
18 ms |
364 KB |
Output is correct |
8 |
Correct |
21 ms |
364 KB |
Output is correct |
9 |
Correct |
18 ms |
364 KB |
Output is correct |
10 |
Correct |
19 ms |
364 KB |
Output is correct |
11 |
Correct |
19 ms |
364 KB |
Output is correct |
12 |
Correct |
17 ms |
364 KB |
Output is correct |
13 |
Correct |
22 ms |
364 KB |
Output is correct |
14 |
Correct |
19 ms |
364 KB |
Output is correct |