Submission #150495

# Submission time Handle Problem Language Result Execution time Memory
150495 2019-09-01T08:31:20 Z CHT를 사랑하는 모임(#3587, moonrabbit2, Retro3014, gs18115) Lokahian Relics (FXCUP4_lokahia) C++17
0 / 100
579 ms 720 KB
#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;
bool chk[205][205];
int cnt;
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&&cnt<10000000&&v.size()>1;i++,cnt++)
	{
		int n=rand()%v.size();
		int j=n;
		while(j==n)
			j=rand()%v.size();
		n=v[n];
		j=v[j];
		if(chk[n][j])
		{
			i--;
			continue;
		}
		chk[n][j]=true;
		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];
}
# Verdict Execution time Memory Grader output
1 Incorrect 6 ms 640 KB Wrong
2 Incorrect 6 ms 640 KB Wrong
3 Incorrect 5 ms 512 KB Wrong
4 Incorrect 6 ms 600 KB Wrong
5 Partially correct 6 ms 640 KB Partially correct : C = 600
6 Incorrect 544 ms 720 KB Wrong
7 Partially correct 6 ms 640 KB Partially correct : C = 600
8 Partially correct 7 ms 640 KB Partially correct : C = 600
9 Partially correct 7 ms 640 KB Partially correct : C = 600
10 Incorrect 6 ms 640 KB Wrong
11 Incorrect 262 ms 640 KB Wrong
12 Incorrect 283 ms 640 KB Wrong
13 Incorrect 579 ms 640 KB Wrong
14 Partially correct 6 ms 640 KB Partially correct : C = 600
15 Incorrect 303 ms 640 KB Wrong
16 Partially correct 7 ms 640 KB Partially correct : C = 600
17 Correct 5 ms 512 KB Correct : C = 0
18 Incorrect 371 ms 644 KB Wrong
19 Incorrect 546 ms 640 KB Wrong
20 Incorrect 6 ms 640 KB Wrong
21 Incorrect 7 ms 640 KB Wrong
22 Incorrect 540 ms 640 KB Wrong
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 6 ms 640 KB Partially correct : C = 600
27 Partially correct 6 ms 640 KB Partially correct : C = 600