#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 = good[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;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
6 ms |
896 KB |
Partially correct : C = 302 |
2 |
Correct |
5 ms |
640 KB |
Correct : C = 120 |
3 |
Correct |
6 ms |
640 KB |
Correct : C = 121 |
4 |
Partially correct |
5 ms |
768 KB |
Partially correct : C = 368 |
5 |
Correct |
6 ms |
768 KB |
Correct : C = 199 |
6 |
Correct |
7 ms |
768 KB |
Correct : C = 200 |
7 |
Runtime error |
7 ms |
1536 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
8 |
Correct |
6 ms |
768 KB |
Correct : C = 200 |
9 |
Correct |
5 ms |
768 KB |
Correct : C = 119 |
10 |
Correct |
5 ms |
512 KB |
Correct : C = 4 |
11 |
Incorrect |
8 ms |
896 KB |
Wrong |
12 |
Correct |
6 ms |
768 KB |
Correct : C = 199 |
13 |
Incorrect |
5 ms |
768 KB |
Wrong |
14 |
Runtime error |
7 ms |
1152 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
15 |
Correct |
5 ms |
640 KB |
Correct : C = 120 |
16 |
Correct |
5 ms |
768 KB |
Correct : C = 200 |
17 |
Incorrect |
5 ms |
640 KB |
Wrong |
18 |
Incorrect |
5 ms |
896 KB |
Wrong |
19 |
Incorrect |
5 ms |
768 KB |
Wrong |
20 |
Correct |
7 ms |
640 KB |
Correct : C = 120 |
21 |
Correct |
6 ms |
512 KB |
Correct : C = 0 |
22 |
Incorrect |
7 ms |
768 KB |
Wrong |
23 |
Incorrect |
6 ms |
768 KB |
Wrong |
24 |
Correct |
6 ms |
768 KB |
Correct : C = 200 |
25 |
Incorrect |
5 ms |
768 KB |
Wrong |
26 |
Runtime error |
7 ms |
1280 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
27 |
Correct |
6 ms |
640 KB |
Correct : C = 119 |