#include"lokahia.h"
#include<cstring>
#include<vector>
#include<ctime>
#include<algorithm>
#define eb emplace_back
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
typedef pair<int,int>pi;
typedef pair<ll,ll>pl;
const ll inf=1e18;
int pa[205],sz[205];
int par(int x)
{
if(pa[x]==-1)
return x;
return pa[x]=par(pa[x]);
}
int C[205];
vector<int>v;
int FindBase(int N)
{
if(N==1)
return 0;
int i;
for(i=0;i<N;i++)
v.eb(i);
memset(pa,-1,sizeof pa);
fill(sz,sz+205,1);
for(i=0;i<600&&v.size()>1;i++)
{
int n=rand()%v.size();
int j=n;
while(j==n)
j=rand()%v.size();
n=v[n];
j=v[j];
int t=CollectRelics(n,j);
if(t!=-1)
{
t=par(t);
if(n!=t)
{
vector<int>::iterator it=v.begin();
while(it!=v.end())
{
if(*it==n)
break;
it++;
}
v.erase(it);
pa[n]=t;
sz[t]+=sz[n];
}
n=j;
if(n!=t)
{
vector<int>::iterator it=v.begin();
while(it!=v.end())
{
if(*it==n)
break;
it++;
}
v.erase(it);
pa[n]=t;
sz[t]+=sz[n];
}
}
}
for(i=0;i<N;i++)
if(pa[i]==-1&&sz[i]>=N/2)
break;
if(i>=N)
return-1;
return sz[i];
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
512 KB |
Correct : C = 0 |
2 |
Incorrect |
6 ms |
512 KB |
Wrong |
3 |
Incorrect |
7 ms |
640 KB |
Wrong |
4 |
Incorrect |
5 ms |
512 KB |
Wrong |
5 |
Incorrect |
6 ms |
640 KB |
Wrong |
6 |
Incorrect |
5 ms |
512 KB |
Wrong |
7 |
Incorrect |
6 ms |
512 KB |
Wrong |
8 |
Partially correct |
6 ms |
512 KB |
Partially correct : C = 600 |
9 |
Incorrect |
6 ms |
640 KB |
Wrong |
10 |
Partially correct |
6 ms |
640 KB |
Partially correct : C = 600 |
11 |
Partially correct |
6 ms |
512 KB |
Partially correct : C = 600 |
12 |
Incorrect |
7 ms |
640 KB |
Wrong |
13 |
Incorrect |
6 ms |
512 KB |
Wrong |
14 |
Incorrect |
6 ms |
640 KB |
Wrong |
15 |
Incorrect |
6 ms |
640 KB |
Wrong |
16 |
Partially correct |
5 ms |
640 KB |
Partially correct : C = 600 |
17 |
Partially correct |
6 ms |
640 KB |
Partially correct : C = 600 |
18 |
Incorrect |
6 ms |
640 KB |
Wrong |
19 |
Incorrect |
6 ms |
512 KB |
Wrong |
20 |
Incorrect |
5 ms |
508 KB |
Wrong |
21 |
Partially correct |
9 ms |
640 KB |
Partially correct : C = 600 |
22 |
Partially correct |
6 ms |
640 KB |
Partially correct : C = 600 |
23 |
Incorrect |
6 ms |
640 KB |
Wrong |
24 |
Partially correct |
6 ms |
640 KB |
Partially correct : C = 600 |
25 |
Incorrect |
6 ms |
640 KB |
Wrong |
26 |
Partially correct |
5 ms |
384 KB |
Partially correct : C = 600 |
27 |
Incorrect |
5 ms |
528 KB |
Wrong |