Submission #988291

# Submission time Handle Problem Language Result Execution time Memory
988291 2024-05-24T12:11:34 Z binminh01 ICC (CEOI16_icc) C++17
Compilation error
0 ms 0 KB
mt19937 rng(43798534);
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)) {
                For(__,0,10) shuffle(all(a), rng); shuffle(all(b), rng);
                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:1:1: error: 'mt19937' does not name a type
    1 | mt19937 rng(43798534);
      | ^~~~~~~
icc.cpp: In function 'void run(int)':
icc.cpp:3:5: error: 'dsu' was not declared in this scope
    3 |     dsu u; u.init(n);
      |     ^~~
icc.cpp:3:12: error: 'u' was not declared in this scope
    3 |     dsu u; u.init(n);
      |            ^
icc.cpp:4:13: error: 'Log2' was not declared in this scope
    4 |     int l = Log2(n);
      |             ^~~~
icc.cpp:5:9: error: '_' was not declared in this scope
    5 |     For(_,1,n){
      |         ^
icc.cpp:5:5: error: 'For' was not declared in this scope
    5 |     For(_,1,n){
      |     ^~~
icc.cpp:4:9: warning: unused variable 'l' [-Wunused-variable]
    4 |     int l = Log2(n);
      |         ^