Submission #1099155

# Submission time Handle Problem Language Result Execution time Memory
1099155 2024-10-10T16:02:22 Z thangdz2k7 Broken Device (JOI17_broken_device) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
#define fi first
#define se second
#include "Annalib.h"

using namespace std;

mt19937 rng(145);

const int m = 150, T = 60;

bitset <T> a[m];

long long rnd(long long l, long long r){
    return l + rng() % (r - l + 1);
}

#define Bit(x, i) (x >> i & 1)

void Anna(int N, long long X, int K, int P[]){
    for (int i = 0; i < m; ++ i){
        for (int j = 0; j < T; ++ j) a[i][j] = rnd(0, 1);
    }

    vector <long long> b(m, 0);
    vector <bool> broken(m, 0);
    for (int i = 0; i < K; ++ i) broken[P[i]] = 1;
    for (int i = 0; i < m; ++ i){
        for (int j = 0; j < T; ++ j) if (a[i][j]) b[i] += (1ll << j);
    }

    bitset <m> base;
    vector <pair <long long, bitset <m>>> basis(T, {0, base});
    for (int i = 0; i < m; ++ i) if (!broken[i]){
        long long x = b[i]; bitset <m> cur; cur.set(i);
        for (int j = 0; j < T; ++ j) if (Bit(x, j)){
            if (!basis[j].fi) {
                basis[j] = {x, cur};
                break;
            }
            x ^= basis[j].fi; cur ^= basis[j].se;
        }
    }

    bitset <m> ans;
    long long x = X;
    for (int j = 0; j < T; ++ j) if (Bit(x, j)){
        x ^= basis[j].fi; ans ^= basis[j].se;
    }
    for (int i = 0; i < m; ++ i) Set(i, ans[i]);
}
#include <bits/stdc++.h>
#include "Brunolib.h"

using namespace std;

mt19937 rng(145);

const int m = 150, T = 60;

bitset <T> a[m];

long long rnd(long long l, long long r){
    return l + rng() % (r - l + 1);
}

long long Bruno(int N, vector <int> A){
    long long xr = 0;
    for (int i = 0; i < m; ++ i){
        long long b = 0;
        for (int j = 0; j < T; ++ j){
            int a = rnd(0, 1);
            if (a) b += (1ll << j);
        }
        if (A[i]) xr ^= b;
    }
    return xr;
}

Compilation message

/usr/bin/ld: /tmp/cce1dX9m.o: in function `main':
grader_bruno.cpp:(.text.startup+0x13d): undefined reference to `Bruno(int, int*)'
collect2: error: ld returned 1 exit status