Submission #1099116

#TimeUsernameProblemLanguageResultExecution timeMemory
1099116thangdz2k7Broken Device (JOI17_broken_device)C++17
0 / 100
242 ms2936 KiB
#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) if (!broken[i]){ for (int j = 0; j < T; ++ j) if (a[i][j]) b[i] += (1ll << j); } vector <pair <long long, int>> basis(T, {0, 0}); for (int i = 0; i < m; ++ i) if (!broken[i]){ long long x = b[i]; for (int j = 0; j < T; ++ j) if (Bit(x, j)){ if (!basis[j].fi) { basis[j] = {x, i}; break; } x ^= basis[j].fi; } } bitset <m> ans; long long x = X; for (int j = 0; j < T; ++ j) if (Bit(x, j)){ ans.set(basis[j].se); x ^= basis[j].fi; } 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 timeMemoryGrader output
Fetching results...