Submission #1078744

#TimeUsernameProblemLanguageResultExecution timeMemory
1078744someoneBroken Device (JOI17_broken_device)C++14
100 / 100
43 ms2920 KiB
#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; }
#Verdict Execution timeMemoryGrader output
Fetching results...