#include"icc.h"
#include<bits/stdc++.h>
using namespace std;
#define f first
#define s second
typedef long long ll;
typedef long double ld;
const int maxn = 105;
const int mod = 998244353;
int t, n;
int up[maxn];
int Find(int x){
if(!up[x])return x;
else return up[x] = Find(up[x]);
}
void Union(int a, int b){
a = Find(a);
b = Find(b);
up[a] = b;
}
int arr1[maxn], arr2[maxn];
int gt(vector<int> a, vector<int> b){
if(a.empty() || b.empty())return 0;
for(int i = 0; i < a.size(); i++)arr1[i] = a[i];
for(int i = 0; i < b.size(); i++)arr2[i] = b[i];
return query(a.size(), b.size(), arr1, arr2);
}
int bs(vector<int> a, vector<int> b){
int l = 0, r = a.size();
while(l < r){
int mid = (l+r+1)>>1;
if(gt(vector<int>(a.begin(), a.begin()+mid), b))l = mid-1;
else r = mid;
}
return a[l];
}
void findedge(vector<int> a, vector<int> b){
assert(!a.empty() && !b.empty());
int h1 = bs(a, b), h2 = bs(b, a);
Union(h1, h2);
setRoad(h1, h2);
}
void run(int N){
n = N;
for(int i = 1; i <= n; i++)up[i]=i;
for(int i = 0; i < n-1; i++){
for(int j = 0; j < 10; j++){
vector<int> v[2];
for(int k = 1; k <= n; k++)v[(Find(k)>>j)&1].push_back(k);
if(gt(v[0], v[1])){
findedge(v[0], v[1]);
break;
}
}
}
}
Compilation message
icc.cpp: In function 'int gt(std::vector<int>, std::vector<int>)':
icc.cpp:33:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
33 | for(int i = 0; i < a.size(); i++)arr1[i] = a[i];
| ~~^~~~~~~~~~
icc.cpp:34:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
34 | for(int i = 0; i < b.size(); i++)arr2[i] = b[i];
| ~~^~~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
141 ms |
262144 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
152 ms |
262144 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
138 ms |
262144 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
160 ms |
262144 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
147 ms |
262144 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
144 ms |
262144 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |