# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1078744 | someone | Broken Device (JOI17_broken_device) | C++14 | 43 ms | 2920 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |