#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);
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){
~~^~~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
6 ms |
640 KB |
Correct : C = 158 |
2 |
Incorrect |
5 ms |
640 KB |
Wrong |
3 |
Correct |
6 ms |
640 KB |
Correct : C = 274 |
4 |
Correct |
6 ms |
512 KB |
Correct : C = 118 |
5 |
Correct |
6 ms |
640 KB |
Correct : C = 164 |
6 |
Incorrect |
6 ms |
640 KB |
Wrong |
7 |
Correct |
6 ms |
640 KB |
Correct : C = 272 |
8 |
Correct |
7 ms |
640 KB |
Correct : C = 131 |
9 |
Correct |
6 ms |
640 KB |
Correct : C = 163 |
10 |
Incorrect |
6 ms |
640 KB |
Wrong |
11 |
Incorrect |
6 ms |
640 KB |
Wrong |
12 |
Incorrect |
6 ms |
640 KB |
Wrong |
13 |
Correct |
5 ms |
640 KB |
Correct : C = 100 |
14 |
Correct |
6 ms |
640 KB |
Correct : C = 271 |
15 |
Correct |
7 ms |
640 KB |
Correct : C = 198 |
16 |
Correct |
6 ms |
640 KB |
Correct : C = 163 |
17 |
Correct |
6 ms |
640 KB |
Correct : C = 105 |
18 |
Correct |
7 ms |
640 KB |
Correct : C = 272 |
19 |
Correct |
6 ms |
512 KB |
Correct : C = 119 |
20 |
Correct |
6 ms |
640 KB |
Correct : C = 163 |
21 |
Correct |
6 ms |
512 KB |
Correct : C = 199 |
22 |
Correct |
9 ms |
640 KB |
Correct : C = 264 |
23 |
Correct |
6 ms |
512 KB |
Correct : C = 4 |
24 |
Correct |
7 ms |
640 KB |
Correct : C = 60 |
25 |
Correct |
5 ms |
512 KB |
Correct : C = 0 |
26 |
Correct |
6 ms |
640 KB |
Correct : C = 264 |
27 |
Incorrect |
6 ms |
640 KB |
Wrong |