#include <bits/stdc++.h>
#include "lokahia.h"
using namespace std;
#define Fi first
#define Se second
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define szz(x) (int)(x).size()
#define rep(i, n) for(int i=0;i<(n);i++)
typedef tuple<int, int, int> t3;
int arr[210];
int myc(int x, int y) {
if(x == y) return x + 1;
int v = CollectRelics(x - 1, y - 1);
if(v == -1) return -1;
return v + 1;
}
int rev[210], rev2[210];
int FindBase(int N) {
vector <int> V, V2;
for(int i=1, p=1, cnt=0, st=1;i<=N;i++) {
if(i == p) ++cnt, arr[i] = 2;
else {
int v = myc(p, i);
if(v == -1) --cnt;
else {
++cnt;
arr[i] = 1;
p = v;
}
}
if(cnt == 0 || i == N) {
V.pb(p);
V2.pb(st);
rev[st] = p;
p = i + 1;
st = i + 1;
}
}
vector <int> List;
int res = V.back(), pp = V2.back();
for(int i=pp;i<=N;i++) if(arr[i] == 2 || arr[i] == 1) List.pb(i);
for(int i=1;i<pp;i++) {
if(arr[i] == 2) {
int ri = rev[i];
int v = myc(ri, res);
if(v != -1) {
List.pb(i);
res = v;
for(int j=i+1;arr[j]!=2;j++) if(arr[j]) List.pb(j);
}
else {
for(int j=i+1;arr[j]!=2;j++) {
if(arr[j]) continue;
int v = myc(j, res);
if(v != -1) List.pb(j), res = v;
}
}
}
}
if(szz(List) >= N / 2 + 1) {
return res - 1;
}
return -1;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
7 ms |
640 KB |
Correct : C = 197 |
2 |
Incorrect |
7 ms |
600 KB |
Wrong |
3 |
Correct |
5 ms |
512 KB |
Correct : C = 0 |
4 |
Correct |
6 ms |
512 KB |
Correct : C = 118 |
5 |
Correct |
7 ms |
560 KB |
Correct : C = 177 |
6 |
Correct |
6 ms |
640 KB |
Correct : C = 178 |
7 |
Correct |
7 ms |
640 KB |
Correct : C = 201 |
8 |
Correct |
7 ms |
640 KB |
Correct : C = 120 |
9 |
Correct |
7 ms |
640 KB |
Correct : C = 198 |
10 |
Correct |
7 ms |
640 KB |
Correct : C = 262 |
11 |
Correct |
6 ms |
640 KB |
Correct : C = 175 |
12 |
Correct |
7 ms |
604 KB |
Correct : C = 276 |
13 |
Incorrect |
7 ms |
604 KB |
Wrong |
14 |
Correct |
6 ms |
512 KB |
Correct : C = 4 |
15 |
Correct |
7 ms |
640 KB |
Correct : C = 197 |
16 |
Correct |
7 ms |
604 KB |
Correct : C = 203 |
17 |
Incorrect |
6 ms |
640 KB |
Wrong |
18 |
Correct |
7 ms |
640 KB |
Correct : C = 205 |
19 |
Correct |
6 ms |
640 KB |
Correct : C = 121 |
20 |
Correct |
6 ms |
512 KB |
Correct : C = 117 |
21 |
Correct |
7 ms |
640 KB |
Correct : C = 203 |
22 |
Incorrect |
6 ms |
640 KB |
Wrong |
23 |
Correct |
6 ms |
640 KB |
Correct : C = 198 |
24 |
Incorrect |
7 ms |
640 KB |
Wrong |
25 |
Incorrect |
6 ms |
512 KB |
Wrong |
26 |
Correct |
6 ms |
640 KB |
Correct : C = 297 |
27 |
Correct |
6 ms |
640 KB |
Correct : C = 298 |