#include <bits/stdc++.h>
using namespace std;
#include "lokahia.h"
int Q[205][205];
int tq = 0;
int query(int i, int j){
if (i == j) return Q[i][i] = i;
else if (Q[i][j] == -2) {
tq++;
return Q[i][j] = Q[j][i] = CollectRelics(i,j);
}
else return Q[i][j];
}
int FindBase(int N){
for (int i = 0; i < N; i++) for (int j = 0; j < N; j++) Q[i][j] = -2;
vector<int> good;
for (int i = 0; i < N; i++) good.push_back(i);
while (tq <= 600){
int cur = 0;
for (auto x : good){
if (cur == x) continue;
int q = query(cur,x);
if (q != -1 && q > cur) cur = q;
}
int ct = 0;
vector<int> bad;
for (auto x : good){
if (x == cur || query(x,cur) != -1) ct++;
else bad.push_back(x);
if (ct > N/2) break;
}
if (ct > N/2) return cur;
swap(good,bad);
bad.clear();
}
return -1;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1094 ms |
768 KB |
Time limit exceeded |
2 |
Correct |
6 ms |
768 KB |
Correct : C = 199 |
3 |
Execution timed out |
1099 ms |
768 KB |
Time limit exceeded |
4 |
Correct |
5 ms |
768 KB |
Correct : C = 200 |
5 |
Execution timed out |
1090 ms |
640 KB |
Time limit exceeded |
6 |
Execution timed out |
1099 ms |
768 KB |
Time limit exceeded |
7 |
Correct |
5 ms |
640 KB |
Correct : C = 119 |
8 |
Execution timed out |
1082 ms |
768 KB |
Time limit exceeded |
9 |
Execution timed out |
1092 ms |
816 KB |
Time limit exceeded |
10 |
Execution timed out |
1085 ms |
768 KB |
Time limit exceeded |
11 |
Correct |
5 ms |
768 KB |
Correct : C = 200 |
12 |
Execution timed out |
1087 ms |
768 KB |
Time limit exceeded |
13 |
Correct |
5 ms |
768 KB |
Correct : C = 200 |
14 |
Execution timed out |
1099 ms |
640 KB |
Time limit exceeded |
15 |
Correct |
5 ms |
512 KB |
Correct : C = 0 |
16 |
Correct |
5 ms |
768 KB |
Correct : C = 119 |
17 |
Correct |
5 ms |
640 KB |
Correct : C = 120 |
18 |
Correct |
5 ms |
640 KB |
Correct : C = 120 |
19 |
Execution timed out |
1091 ms |
640 KB |
Time limit exceeded |
20 |
Correct |
5 ms |
768 KB |
Correct : C = 200 |
21 |
Execution timed out |
1099 ms |
768 KB |
Time limit exceeded |
22 |
Execution timed out |
1096 ms |
640 KB |
Time limit exceeded |
23 |
Correct |
5 ms |
640 KB |
Correct : C = 121 |
24 |
Correct |
5 ms |
768 KB |
Correct : C = 199 |
25 |
Correct |
5 ms |
640 KB |
Correct : C = 120 |
26 |
Execution timed out |
1099 ms |
768 KB |
Time limit exceeded |
27 |
Correct |
5 ms |
512 KB |
Correct : C = 4 |