#include"lokahia.h"
#include<vector>
#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 FindBase(int N)
{
int cnt=0,tgt=0;
vector<int>tgs,szs;
vector<vector<int> >difs;
int i;
for(i=0;i<N;i++)
{
if(cnt==0)
{
tgt=i;
cnt=1;
tgs.eb(tgt);
szs.eb(1);
difs.eb(vector<int>());
}
else
{
if(CollectRelics(tgt,i)!=-1)
cnt++,szs[szs.size()-1]++;
else
difs.back().eb(i),cnt--;
}
}
int t=tgs.back();
int n=tgs.size();
cnt=0;
for(i=0;i<n;i++)
{
if(tgs[i]==t)
cnt+=szs[i];
else
{
if(CollectRelics(tgs[i],t)!=-1)
cnt+=szs[i];
else
for(int m:difs[i])
if(CollectRelics(t,m)!=-1)
cnt++;
}
}
if(cnt>=N/2)
return t+1;
return-1;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
6 ms |
512 KB |
Correct : C = 177 |
2 |
Incorrect |
6 ms |
512 KB |
Wrong |
3 |
Correct |
6 ms |
640 KB |
Correct : C = 297 |
4 |
Incorrect |
6 ms |
512 KB |
Wrong |
5 |
Incorrect |
6 ms |
640 KB |
Wrong |
6 |
Correct |
6 ms |
512 KB |
Correct : C = 4 |
7 |
Incorrect |
7 ms |
640 KB |
Wrong |
8 |
Correct |
6 ms |
640 KB |
Correct : C = 298 |
9 |
Incorrect |
7 ms |
640 KB |
Wrong |
10 |
Correct |
7 ms |
688 KB |
Correct : C = 279 |
11 |
Incorrect |
6 ms |
512 KB |
Wrong |
12 |
Correct |
6 ms |
640 KB |
Correct : C = 204 |
13 |
Incorrect |
6 ms |
512 KB |
Wrong |
14 |
Incorrect |
6 ms |
640 KB |
Wrong |
15 |
Incorrect |
6 ms |
640 KB |
Wrong |
16 |
Incorrect |
6 ms |
512 KB |
Wrong |
17 |
Incorrect |
6 ms |
600 KB |
Wrong |
18 |
Incorrect |
5 ms |
512 KB |
Wrong |
19 |
Incorrect |
6 ms |
640 KB |
Wrong |
20 |
Incorrect |
6 ms |
640 KB |
Wrong |
21 |
Incorrect |
6 ms |
640 KB |
Wrong |
22 |
Incorrect |
6 ms |
640 KB |
Wrong |
23 |
Correct |
5 ms |
512 KB |
Correct : C = 177 |
24 |
Correct |
5 ms |
512 KB |
Correct : C = 178 |
25 |
Incorrect |
6 ms |
640 KB |
Wrong |
26 |
Correct |
6 ms |
640 KB |
Correct : C = 269 |
27 |
Incorrect |
6 ms |
640 KB |
Wrong |