#include "lokahia.h"
#include <bits/stdc++.h>
using namespace std;
int FindBase(int N){
vector<vector<int> > s, t, de;
vector<int> la;
for(int i = 0; i < N; i++)
s.push_back({i});
while(s.size() > 1){
for(int i = 1; i < s.size(); i += 2){
if(CollectRelics(s[i - 1][0], s[i][0]) == -1){
de.push_back(s[i - 1]);
de.push_back(s[i]);
} else {
for(int& x : s[i - 1])
s[i].push_back(x);
t.push_back(s[i]);
}
}
if(s.size() & 1){
de.push_back(s.back());
la = s.back();
}
swap(s, t);
t.clear();
}
int sz = 0;
if(s.empty()) s.push_back(la);
else sz = s[0].size();
if(s[0].empty()) return -1;
int res = 0;
for(auto& x : de){
int rrr = CollectRelics(x[0], s[0][0]);
if(rrr != -1){
res = max(res, rrr);
for(int i = 1; i < x.size(); i++){
rrr = CollectRelics(x[i], s[0][0]);
res = max(res, rrr);
}
sz += x.size();
}
}
if(sz > N / 2) return res;
return -1;
}
Compilation message
lokahia.cpp: In function 'int FindBase(int)':
lokahia.cpp:13:26: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int i = 1; i < s.size(); i += 2){
~~^~~~~~~~~~
lokahia.cpp:44:30: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int i = 1; i < x.size(); i++){
~~^~~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
6 ms |
640 KB |
Wrong |
2 |
Correct |
5 ms |
512 KB |
Correct : C = 172 |
3 |
Incorrect |
6 ms |
640 KB |
Wrong |
4 |
Incorrect |
6 ms |
640 KB |
Wrong |
5 |
Correct |
5 ms |
640 KB |
Correct : C = 173 |
6 |
Correct |
6 ms |
640 KB |
Correct : C = 265 |
7 |
Correct |
6 ms |
640 KB |
Correct : C = 268 |
8 |
Correct |
6 ms |
640 KB |
Correct : C = 168 |
9 |
Correct |
5 ms |
640 KB |
Correct : C = 163 |
10 |
Correct |
6 ms |
640 KB |
Correct : C = 173 |
11 |
Incorrect |
6 ms |
640 KB |
Wrong |
12 |
Correct |
6 ms |
640 KB |
Correct : C = 105 |
13 |
Correct |
5 ms |
640 KB |
Correct : C = 175 |
14 |
Correct |
6 ms |
640 KB |
Correct : C = 269 |
15 |
Correct |
6 ms |
640 KB |
Correct : C = 285 |
16 |
Correct |
6 ms |
512 KB |
Correct : C = 4 |
17 |
Correct |
6 ms |
640 KB |
Correct : C = 283 |
18 |
Correct |
6 ms |
512 KB |
Correct : C = 60 |
19 |
Correct |
6 ms |
640 KB |
Correct : C = 290 |
20 |
Correct |
6 ms |
640 KB |
Correct : C = 100 |
21 |
Incorrect |
6 ms |
640 KB |
Wrong |
22 |
Correct |
6 ms |
640 KB |
Correct : C = 287 |
23 |
Correct |
6 ms |
512 KB |
Correct : C = 174 |
24 |
Correct |
6 ms |
640 KB |
Correct : C = 131 |
25 |
Incorrect |
6 ms |
640 KB |
Wrong |
26 |
Correct |
7 ms |
640 KB |
Correct : C = 265 |
27 |
Correct |
6 ms |
512 KB |
Correct : C = 0 |