#include <bits/stdc++.h>
using namespace std;
#include "lokahia.h"
int Q[205][205];
const int LIM = 400;
int tq = 0;
int query(int i, int j){
if (i == j) return Q[i][i] = i;
else if (tq >= LIM) return -1;
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 (good.size() && tq <= LIM){
random_shuffle(good.begin(),good.end());
int cur = good[0];
srand(time(NULL));
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;
good.clear();
for (auto x : bad){
good.push_back(x);
}
bad.clear();
}
return -1;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
5 ms |
512 KB |
Wrong |
2 |
Incorrect |
5 ms |
768 KB |
Wrong |
3 |
Partially correct |
5 ms |
640 KB |
Partially correct : C = 400 |
4 |
Incorrect |
5 ms |
768 KB |
Wrong |
5 |
Incorrect |
5 ms |
640 KB |
Wrong |
6 |
Incorrect |
5 ms |
640 KB |
Wrong |
7 |
Incorrect |
5 ms |
640 KB |
Wrong |
8 |
Incorrect |
5 ms |
768 KB |
Wrong |
9 |
Partially correct |
6 ms |
768 KB |
Partially correct : C = 400 |
10 |
Partially correct |
8 ms |
768 KB |
Partially correct : C = 400 |
11 |
Partially correct |
5 ms |
640 KB |
Partially correct : C = 400 |
12 |
Partially correct |
5 ms |
768 KB |
Partially correct : C = 387 |
13 |
Incorrect |
6 ms |
768 KB |
Wrong |
14 |
Incorrect |
5 ms |
640 KB |
Wrong |
15 |
Partially correct |
6 ms |
768 KB |
Partially correct : C = 400 |
16 |
Partially correct |
8 ms |
768 KB |
Partially correct : C = 400 |
17 |
Partially correct |
6 ms |
820 KB |
Partially correct : C = 400 |
18 |
Incorrect |
5 ms |
768 KB |
Wrong |
19 |
Correct |
4 ms |
512 KB |
Correct : C = 0 |
20 |
Partially correct |
5 ms |
768 KB |
Partially correct : C = 301 |
21 |
Partially correct |
5 ms |
692 KB |
Partially correct : C = 400 |
22 |
Incorrect |
5 ms |
640 KB |
Wrong |
23 |
Incorrect |
6 ms |
768 KB |
Wrong |
24 |
Incorrect |
5 ms |
768 KB |
Wrong |
25 |
Partially correct |
6 ms |
640 KB |
Partially correct : C = 383 |
26 |
Partially correct |
6 ms |
768 KB |
Partially correct : C = 400 |
27 |
Incorrect |
5 ms |
640 KB |
Wrong |