#include "lokahia.h"
#include <bits/stdc++.h>
using namespace std;
const int N = 205;
int com[N];
int FindBase(int n)
{
fill(com, com + n, -1);
vector<int> s, t, de;
int la = 0;
for (int i = 0; i < n; i++)
s.push_back(i);
while (s.size() >= 1)
{
sort(s.begin(), s.end());
s.erase(unique(s.begin(), s.end()), s.end());
for (int i = 1; i < s.size(); i += 2)
{
int u = CollectRelics(s[i - 1], s[i]);
if (u != -1)
{
com[s[i] - 1] = com[s[i]] = com[u] = u;
t.push_back(u);
}
}
if (s.size() & 1)
{
de.push_back(s.back());
la = s.back();
}
swap(s, t);
t.clear();
}
int sz = 0;
for (int i = 0; i < n; i++)
if (com[i] == la)
sz++;
else if (com[i] == -1 && CollectRelics(la, i) != -1)
sz++;
return sz > n / 2 ? la : -1;
}
Compilation message
lokahia.cpp: In function 'int FindBase(int)':
lokahia.cpp:20:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (int i = 1; i < s.size(); i += 2)
~~^~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
6 ms |
640 KB |
Wrong |
2 |
Correct |
6 ms |
512 KB |
Correct : C = 143 |
3 |
Incorrect |
7 ms |
640 KB |
Wrong |
4 |
Incorrect |
5 ms |
640 KB |
Wrong |
5 |
Incorrect |
5 ms |
640 KB |
Wrong |
6 |
Correct |
6 ms |
640 KB |
Correct : C = 132 |
7 |
Correct |
6 ms |
640 KB |
Correct : C = 100 |
8 |
Incorrect |
6 ms |
640 KB |
Wrong |
9 |
Incorrect |
6 ms |
700 KB |
Wrong |
10 |
Incorrect |
6 ms |
640 KB |
Wrong |
11 |
Incorrect |
6 ms |
512 KB |
Wrong |
12 |
Correct |
6 ms |
640 KB |
Correct : C = 60 |
13 |
Correct |
5 ms |
640 KB |
Correct : C = 150 |
14 |
Correct |
6 ms |
640 KB |
Correct : C = 250 |
15 |
Incorrect |
5 ms |
512 KB |
Wrong |
16 |
Correct |
5 ms |
384 KB |
Correct : C = 3 |
17 |
Incorrect |
7 ms |
640 KB |
Wrong |
18 |
Correct |
5 ms |
640 KB |
Correct : C = 60 |
19 |
Correct |
7 ms |
640 KB |
Correct : C = 100 |
20 |
Correct |
6 ms |
512 KB |
Correct : C = 204 |
21 |
Incorrect |
6 ms |
512 KB |
Wrong |
22 |
Incorrect |
6 ms |
640 KB |
Wrong |
23 |
Correct |
6 ms |
512 KB |
Correct : C = 150 |
24 |
Incorrect |
7 ms |
640 KB |
Wrong |
25 |
Incorrect |
6 ms |
640 KB |
Wrong |
26 |
Incorrect |
6 ms |
640 KB |
Wrong |
27 |
Correct |
5 ms |
640 KB |
Correct : C = 229 |