Submission #1099158

# Submission time Handle Problem Language Result Execution time Memory
1099158 2024-10-10T16:04:01 Z thangdz2k7 Broken Device (JOI17_broken_device) C++17
100 / 100
252 ms 2964 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, 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;
}
# Verdict Execution time Memory Grader output
1 Correct 247 ms 2760 KB Output is correct - L* = 40
2 Correct 250 ms 2752 KB Output is correct - L* = 40
3 Correct 250 ms 2680 KB Output is correct - L* = 40
4 Correct 244 ms 2788 KB Output is correct - L* = 40
5 Correct 245 ms 2680 KB Output is correct - L* = 40
6 Correct 241 ms 2680 KB Output is correct - L* = 40
7 Correct 243 ms 2684 KB Output is correct - L* = 40
8 Correct 242 ms 2680 KB Output is correct - L* = 40
9 Correct 252 ms 2676 KB Output is correct - L* = 40
10 Correct 243 ms 2660 KB Output is correct - L* = 40
11 Correct 246 ms 2756 KB Output is correct - L* = 40
12 Correct 245 ms 2964 KB Output is correct - L* = 40
13 Correct 245 ms 2768 KB Output is correct - L* = 40
14 Correct 244 ms 2712 KB Output is correct - L* = 40
15 Correct 244 ms 2728 KB Output is correct - L* = 40
16 Correct 246 ms 2664 KB Output is correct - L* = 40
17 Correct 246 ms 2688 KB Output is correct - L* = 40
18 Correct 245 ms 2676 KB Output is correct - L* = 40
19 Correct 245 ms 2576 KB Output is correct - L* = 40
20 Correct 247 ms 2720 KB Output is correct - L* = 40
21 Correct 245 ms 2764 KB Output is correct - L* = 40
22 Correct 245 ms 2688 KB Output is correct - L* = 40
23 Correct 246 ms 2684 KB Output is correct - L* = 40
24 Correct 242 ms 2652 KB Output is correct - L* = 40
25 Correct 242 ms 2680 KB Output is correct - L* = 40
26 Correct 242 ms 2840 KB Output is correct - L* = 40
27 Correct 244 ms 2728 KB Output is correct - L* = 40
28 Correct 243 ms 2720 KB Output is correct - L* = 40
29 Correct 248 ms 2676 KB Output is correct - L* = 40
30 Correct 248 ms 2628 KB Output is correct - L* = 40
31 Correct 245 ms 2784 KB Output is correct - L* = 40
32 Correct 246 ms 2680 KB Output is correct - L* = 40
33 Correct 244 ms 2608 KB Output is correct - L* = 40
34 Correct 243 ms 2676 KB Output is correct - L* = 40
35 Correct 245 ms 2616 KB Output is correct - L* = 40
36 Correct 245 ms 2760 KB Output is correct - L* = 40
37 Correct 244 ms 2712 KB Output is correct - L* = 40
38 Correct 248 ms 2672 KB Output is correct - L* = 40
39 Correct 246 ms 2756 KB Output is correct - L* = 40
40 Correct 247 ms 2676 KB Output is correct - L* = 40