# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
988278 |
2024-05-24T12:01:52 Z |
binminh01 |
ICC (CEOI16_icc) |
C++17 |
|
0 ms |
0 KB |
void run(int n) {
dsu u; u.init(n);
int l = Log2(n);
For(_,1,n){
For(i,0,l){
vi a, b;
For(j,0,n){
int w = u.get(j);
if ((w >> i) & 1) a.pb(j);
else b.pb(j);
}
if (query(a, b)) {
shuffle(all(a), mt); shuffle(all(b), mt);
int l = 0, r = sz(a) - 1;
while (l < r) {
int m = (l + r) >> 1;
if (query(vi(a.begin() + l, a.begin() + m + 1), b)) r = m;
else l = m + 1;
}
int x = l;
l = 0; r = sz(b) - 1;
while (l < r) {
int m = (l + r) >> 1;
if (query(vi{a[x]}, vi(b.begin() + l, b.begin() + m + 1))) r = m;
else l = m + 1;
}
int y = l;
u.merge(a[x], b[y]);
setRoad(a[x] + 1, b[y] + 1);
break;
}
}
}
}
Compilation message
icc.cpp: In function 'void run(int)':
icc.cpp:2:5: error: 'dsu' was not declared in this scope
2 | dsu u; u.init(n);
| ^~~
icc.cpp:2:12: error: 'u' was not declared in this scope
2 | dsu u; u.init(n);
| ^
icc.cpp:3:13: error: 'Log2' was not declared in this scope
3 | int l = Log2(n);
| ^~~~
icc.cpp:4:9: error: '_' was not declared in this scope
4 | For(_,1,n){
| ^
icc.cpp:4:5: error: 'For' was not declared in this scope
4 | For(_,1,n){
| ^~~
icc.cpp:3:9: warning: unused variable 'l' [-Wunused-variable]
3 | int l = Log2(n);
| ^