#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;
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)
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)
~~^~~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
6 ms |
640 KB |
Wrong |
2 |
Incorrect |
7 ms |
640 KB |
Wrong |
3 |
Correct |
6 ms |
512 KB |
Correct : C = 204 |
4 |
Correct |
6 ms |
640 KB |
Correct : C = 100 |
5 |
Incorrect |
6 ms |
640 KB |
Wrong |
6 |
Correct |
6 ms |
640 KB |
Correct : C = 229 |
7 |
Correct |
6 ms |
512 KB |
Correct : C = 150 |
8 |
Incorrect |
6 ms |
640 KB |
Wrong |
9 |
Incorrect |
6 ms |
512 KB |
Wrong |
10 |
Correct |
6 ms |
512 KB |
Correct : C = 3 |
11 |
Correct |
6 ms |
512 KB |
Correct : C = 132 |
12 |
Incorrect |
6 ms |
512 KB |
Wrong |
13 |
Incorrect |
5 ms |
512 KB |
Wrong |
14 |
Correct |
7 ms |
640 KB |
Correct : C = 100 |
15 |
Correct |
6 ms |
512 KB |
Correct : C = 60 |
16 |
Incorrect |
6 ms |
640 KB |
Wrong |
17 |
Incorrect |
6 ms |
512 KB |
Wrong |
18 |
Incorrect |
6 ms |
512 KB |
Wrong |
19 |
Incorrect |
6 ms |
640 KB |
Wrong |
20 |
Correct |
6 ms |
512 KB |
Correct : C = 143 |
21 |
Correct |
6 ms |
640 KB |
Correct : C = 150 |
22 |
Incorrect |
7 ms |
636 KB |
Wrong |
23 |
Incorrect |
6 ms |
520 KB |
Wrong |
24 |
Incorrect |
6 ms |
512 KB |
Wrong |
25 |
Correct |
6 ms |
640 KB |
Correct : C = 250 |
26 |
Correct |
6 ms |
512 KB |
Correct : C = 60 |
27 |
Incorrect |
6 ms |
560 KB |
Wrong |