#include <bits/stdc++.h>
#define x first
#define y second
using namespace std;
int CollectRelics(int,int);
set<pair<int,int> >st,st2;
int FindBase(int N){
int i;
for(i=0;i<N;i++)
{
st.insert(make_pair(1,i));
}
while(st.size()>=2)
{
//printf("%d %d %d %d %d\n",st.begin()->y,next(st.begin())->y,st.begin()->x,next(st.begin())->x,CollectRelics(st.begin()->y,next(st.begin())->y));
if(st.begin()->x==next(st.begin())->x)
{
int temp=st.begin()->y==next(st.begin())->y?st.begin()->y:CollectRelics(st.begin()->y,next(st.begin())->y);
if(temp!=-1)
{
st.erase(next(st.begin()));
st.insert(make_pair(st.begin()->x*2,temp));
st.erase(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());
}
}
if(st.empty()) return -1;
int las=st.begin()->y;
int ans=st.begin()->x;
st.erase(st.begin());
for(set<pair<int,int> >::iterator it=st2.begin();it!=st2.end();it++)
{
int temp=las==it->y?las:CollectRelics(las,it->y);
if(temp!=-1)
{
las=temp;
ans+=it->x;
}
}
if(ans>N/2)
return las;
return -1;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
632 KB |
Wrong |
2 |
Correct |
1 ms |
632 KB |
Correct : C = 3 |
3 |
Incorrect |
3 ms |
632 KB |
Wrong |
4 |
Incorrect |
2 ms |
552 KB |
Wrong |
5 |
Correct |
2 ms |
632 KB |
Correct : C = 297 |
6 |
Correct |
3 ms |
632 KB |
Correct : C = 100 |
7 |
Correct |
2 ms |
504 KB |
Correct : C = 177 |
8 |
Correct |
3 ms |
632 KB |
Correct : C = 101 |
9 |
Incorrect |
2 ms |
632 KB |
Wrong |
10 |
Correct |
3 ms |
632 KB |
Correct : C = 103 |
11 |
Incorrect |
3 ms |
636 KB |
Wrong |
12 |
Correct |
3 ms |
632 KB |
Correct : C = 101 |
13 |
Incorrect |
3 ms |
632 KB |
Wrong |
14 |
Correct |
3 ms |
632 KB |
Correct : C = 101 |
15 |
Incorrect |
3 ms |
632 KB |
Wrong |
16 |
Correct |
2 ms |
552 KB |
Correct : C = 146 |
17 |
Correct |
2 ms |
632 KB |
Correct : C = 150 |
18 |
Correct |
3 ms |
632 KB |
Correct : C = 250 |
19 |
Correct |
2 ms |
376 KB |
Correct : C = 0 |
20 |
Incorrect |
2 ms |
680 KB |
Wrong |
21 |
Incorrect |
3 ms |
632 KB |
Wrong |
22 |
Incorrect |
2 ms |
552 KB |
Wrong |
23 |
Incorrect |
3 ms |
632 KB |
Wrong |
24 |
Correct |
2 ms |
504 KB |
Correct : C = 60 |
25 |
Incorrect |
3 ms |
632 KB |
Wrong |
26 |
Incorrect |
2 ms |
504 KB |
Wrong |
27 |
Incorrect |
2 ms |
504 KB |
Wrong |