Submission #1078731

# Submission time Handle Problem Language Result Execution time Memory
1078731 2024-08-28T05:17:21 Z someone Broken Device (JOI17_broken_device) C++14
100 / 100
55 ms 3052 KB
#include "Annalib.h"
#include <bits/stdc++.h>
#define sz(x) (int)x.size()
#define all(x) x.begin(), x.end()
using i64 = long long;
using namespace std;

const int D = 60;

i64 b[D];
bitset<150> id[D];

void insert(i64 x, int idx) {
    bitset<150> act;
    act[idx] = 1;
    for(int i = D-1; i >= 0; i--)
        if(x & (1ll << i)) {
            if(b[i] == 0) {
                b[i] = x;
                id[i] = act;
                return;
            }
            x ^= b[i];
            act ^= id[i];
        }
}

void Anna(int N, long long X, int K, int P[]) {
    for(int i = 0; i < D; i++) b[i] = 0;
    vector<int> broken(N);
    for(int i = 0; i < K; i++)
        broken[P[i]] = 1;

    mt19937_64 rng(42);
    vector<i64> val(N);
    for(int i = 0; i < N; i++) {
        val[i] = rng() & ((1ll << 60) - 1);
        if(!broken[i]) insert(val[i], i);
    }
    bitset<150> ans;
    for(int i = D-1; i >= 0; i--) {
        if(X & (1ll << i)) {
            X ^= b[i];
            ans ^= id[i];
        }
    }
    for(int i = 0; i < N; i++)
        Set(i, ans[i]);
}
#include "Brunolib.h"
#include <bits/stdc++.h>
#define sz(x) (int)x.size()
#define all(x) x.begin(), x.end()
using i64 = long long;
using namespace std;


long long Bruno( int N, int A[] ){
    mt19937_64 rng(42);
    i64 X = 0;
    for(int i = 0; i < N; i++) {
        i64 val = rng() & ((1ll << 60) - 1);
        if(A[i]) X ^= val;
    }
    return X;
}
# Verdict Execution time Memory Grader output
1 Correct 45 ms 2752 KB Output is correct - L* = 40
2 Correct 46 ms 2784 KB Output is correct - L* = 40
3 Correct 45 ms 2692 KB Output is correct - L* = 40
4 Correct 46 ms 2672 KB Output is correct - L* = 40
5 Correct 43 ms 2668 KB Output is correct - L* = 40
6 Correct 55 ms 2768 KB Output is correct - L* = 40
7 Correct 44 ms 2676 KB Output is correct - L* = 40
8 Correct 45 ms 2684 KB Output is correct - L* = 40
9 Correct 48 ms 2676 KB Output is correct - L* = 40
10 Correct 46 ms 2744 KB Output is correct - L* = 40
11 Correct 49 ms 3052 KB Output is correct - L* = 40
12 Correct 46 ms 2740 KB Output is correct - L* = 40
13 Correct 54 ms 2544 KB Output is correct - L* = 40
14 Correct 46 ms 2836 KB Output is correct - L* = 40
15 Correct 45 ms 2620 KB Output is correct - L* = 40
16 Correct 45 ms 2752 KB Output is correct - L* = 40
17 Correct 44 ms 2684 KB Output is correct - L* = 40
18 Correct 47 ms 2740 KB Output is correct - L* = 40
19 Correct 44 ms 2736 KB Output is correct - L* = 40
20 Correct 47 ms 2684 KB Output is correct - L* = 40
21 Correct 44 ms 2772 KB Output is correct - L* = 40
22 Correct 46 ms 2740 KB Output is correct - L* = 40
23 Correct 46 ms 2736 KB Output is correct - L* = 40
24 Correct 51 ms 2772 KB Output is correct - L* = 40
25 Correct 43 ms 2636 KB Output is correct - L* = 40
26 Correct 45 ms 2532 KB Output is correct - L* = 40
27 Correct 46 ms 2744 KB Output is correct - L* = 40
28 Correct 43 ms 2676 KB Output is correct - L* = 40
29 Correct 45 ms 2592 KB Output is correct - L* = 40
30 Correct 45 ms 2748 KB Output is correct - L* = 40
31 Correct 53 ms 2832 KB Output is correct - L* = 40
32 Correct 44 ms 2568 KB Output is correct - L* = 40
33 Correct 44 ms 2692 KB Output is correct - L* = 40
34 Correct 47 ms 2592 KB Output is correct - L* = 40
35 Correct 46 ms 2744 KB Output is correct - L* = 40
36 Correct 55 ms 2564 KB Output is correct - L* = 40
37 Correct 50 ms 2752 KB Output is correct - L* = 40
38 Correct 44 ms 2676 KB Output is correct - L* = 40
39 Correct 48 ms 2672 KB Output is correct - L* = 40
40 Correct 44 ms 2744 KB Output is correct - L* = 40