Submission #151185

# Submission time Handle Problem Language Result Execution time Memory
151185 2019-09-02T04:36:15 Z babo Lokahian Relics (FXCUP4_lokahia) C++17
0 / 100
1000 ms 632 KB
#include <bits/stdc++.h>

using namespace std;

int CollectRelics(int,int);

int bu[222],sz[222];
set<int>st,st2;

int FindBase(int N){
	int i;
	for(i=0;i<N;i++)
	{
		bu[i]=i;
		sz[i]=1;
		st.insert(i);
	}
	while(st.size()>=2)
	{
		if(sz[*st.begin()]==sz[*next(st.begin())])
		{
			if(CollectRelics(*st.begin(),*next(st.begin()))!=-1)
			{
				bu[*next(st.begin())]=*st.begin();
				sz[*st.begin()]*=2;
				st.erase(next(st.begin()));
			}
			else
			{
				st2.insert(*st.begin());
				st.erase(st.begin());
				st2.insert(*st.begin());
				st.erase(st.begin());
			}
		}
		else
		{
			st2.insert(*st.begin());
			st.erase(st.begin());
		}
	}
	int las=*st.begin();
	//printf("las %d sz %d\n",las,sz[las]);
	int ans=sz[las];
	st.erase(st.begin());
	for(set<int>::iterator it=st2.begin();it!=st2.end();it++)
	{
		int temp=CollectRelics(las,*it);
		if(temp!=-1)
		{
			las=temp;
			ans++;
		}
	}
	if(ans>=N%2?N/2+1:N/2)
		return las;
	return -1;
}
# Verdict Execution time Memory Grader output
1 Execution timed out 3041 ms 552 KB Time limit exceeded
2 Incorrect 2 ms 504 KB Wrong
3 Correct 3 ms 632 KB Correct : C = 162
4 Correct 2 ms 632 KB Correct : C = 163
5 Correct 2 ms 504 KB Correct : C = 0
6 Execution timed out 3010 ms 508 KB Time limit exceeded
7 Correct 3 ms 632 KB Correct : C = 255
8 Incorrect 3 ms 632 KB Wrong
9 Incorrect 3 ms 552 KB Wrong
10 Incorrect 3 ms 632 KB Wrong
11 Incorrect 2 ms 632 KB Wrong
12 Execution timed out 3027 ms 632 KB Time limit exceeded
13 Incorrect 2 ms 632 KB Wrong
14 Execution timed out 3022 ms 540 KB Time limit exceeded
15 Execution timed out 3023 ms 632 KB Time limit exceeded
16 Execution timed out 3059 ms 632 KB Time limit exceeded
17 Incorrect 3 ms 632 KB Wrong
18 Incorrect 3 ms 632 KB Wrong
19 Incorrect 2 ms 632 KB Wrong
20 Incorrect 2 ms 504 KB Wrong
21 Execution timed out 3021 ms 504 KB Time limit exceeded
22 Execution timed out 3015 ms 632 KB Time limit exceeded
23 Incorrect 3 ms 632 KB Wrong
24 Incorrect 2 ms 632 KB Wrong
25 Correct 2 ms 376 KB Correct : C = 4
26 Incorrect 3 ms 632 KB Wrong
27 Correct 3 ms 628 KB Correct : C = 198