답안 #1078744

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1078744 2024-08-28T05:35:59 Z someone Broken Device (JOI17_broken_device) C++14
100 / 100
43 ms 2920 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 < min(N, 110); 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;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 34 ms 2760 KB Output is correct - L* = 40
2 Correct 41 ms 2708 KB Output is correct - L* = 40
3 Correct 36 ms 2660 KB Output is correct - L* = 40
4 Correct 37 ms 2664 KB Output is correct - L* = 40
5 Correct 38 ms 2720 KB Output is correct - L* = 40
6 Correct 35 ms 2724 KB Output is correct - L* = 40
7 Correct 34 ms 2612 KB Output is correct - L* = 40
8 Correct 36 ms 2764 KB Output is correct - L* = 40
9 Correct 39 ms 2548 KB Output is correct - L* = 40
10 Correct 34 ms 2720 KB Output is correct - L* = 40
11 Correct 42 ms 2676 KB Output is correct - L* = 40
12 Correct 34 ms 2604 KB Output is correct - L* = 40
13 Correct 37 ms 2848 KB Output is correct - L* = 40
14 Correct 37 ms 2752 KB Output is correct - L* = 40
15 Correct 38 ms 2648 KB Output is correct - L* = 40
16 Correct 34 ms 2656 KB Output is correct - L* = 40
17 Correct 34 ms 2632 KB Output is correct - L* = 40
18 Correct 36 ms 2732 KB Output is correct - L* = 40
19 Correct 36 ms 2692 KB Output is correct - L* = 40
20 Correct 34 ms 2616 KB Output is correct - L* = 40
21 Correct 34 ms 2676 KB Output is correct - L* = 40
22 Correct 39 ms 2644 KB Output is correct - L* = 40
23 Correct 36 ms 2728 KB Output is correct - L* = 40
24 Correct 37 ms 2748 KB Output is correct - L* = 40
25 Correct 37 ms 2648 KB Output is correct - L* = 40
26 Correct 34 ms 2756 KB Output is correct - L* = 40
27 Correct 36 ms 2736 KB Output is correct - L* = 40
28 Correct 37 ms 2508 KB Output is correct - L* = 40
29 Correct 43 ms 2568 KB Output is correct - L* = 40
30 Correct 38 ms 2844 KB Output is correct - L* = 40
31 Correct 34 ms 2732 KB Output is correct - L* = 40
32 Correct 35 ms 2696 KB Output is correct - L* = 40
33 Correct 36 ms 2724 KB Output is correct - L* = 40
34 Correct 34 ms 2920 KB Output is correct - L* = 40
35 Correct 34 ms 2612 KB Output is correct - L* = 40
36 Correct 34 ms 2760 KB Output is correct - L* = 40
37 Correct 34 ms 2728 KB Output is correct - L* = 40
38 Correct 36 ms 2828 KB Output is correct - L* = 40
39 Correct 34 ms 2724 KB Output is correct - L* = 40
40 Correct 36 ms 2632 KB Output is correct - L* = 40