# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1142638 | OI_Account | Broken Device (JOI17_broken_device) | C++20 | 0 ms | 0 KiB |
#include "Annalib.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 150;
const int M = 59;
const ll x[N] = {777523539921853505, 256004525803361772, 308305258728183102, 582745572890801791, 549292889148046381, 599698824668116389, 542111641530190889, 357772020071635407, 109402569541188054, 5878083635208241, 989597678449481750, 809250368948503439, 994344248487496567, 299171316159037239, 797555524300478742, 981313440474340818, 698135450199770811, 956964208817395377, 995831931848466817, 448359660972415504, 862423402299864600, 801814343641537265, 311781361602019705, 777734920438109133, 580938439913520741, 289987690178347392, 258668017375809564, 288091600886742779, 25908348031121769, 344387309598287137, 504165594281223965, 741731246967608369, 485614883627857654, 808024499261395942, 242536403939624977, 183068567155725681, 740803632367211547, 502531793125307201, 99586522124545388, 208300672617238699, 322313812028614563, 221289985247795252, 10326911613079258, 308066933530881736, 20744043878119823, 725293300288995213, 740793681085073577, 140507163506247369, 681835731921478784, 50242555061706965, 347922011874963235, 382391377047202806, 342007485918078953, 110910543544906163, 937585650047628937, 898831968258419494, 299760824468325089, 200901937990415314, 627493372067307581, 9335688382631275, 704891135349134354, 513228825447409702, 280767870337731883, 194631383138767250, 265412659824565020, 149204939291390483, 332437534371063328, 593083350677388403, 380739899631345380, 68981156002880522, 898847677530913978, 42188585005920551, 331973439114305435, 428101008952006083, 740448352331609582, 556818344531122135, 498449343713428533, 695980271928755861, 593880401288963563, 199139121099849226, 601187357705837908, 918392557402589838, 863159770020835672, 316526537369761786, 35259610614239594, 698824457564801534, 413180120839817472, 425967365239469353, 142139806994845389, 818256621045964533, 690385704471992311, 545208671095536136, 507108612721245324, 271988533132589082, 307230711328072850, 246932709923986578, 769179018881842644, 744667777884179957, 65828547078679205, 578658460393691384, 306085085535947297, 256043553073910205, 985346280769651961, 247676969122846339, 622116587239151596, 250641039455468296, 298346051710416720, 130509902683469539, 110941849253522407, 38885328767620420, 403351582171109415, 78248166236264673, 22170989365573794, 791685132468809429, 906111832624415828, 353814842702750221, 637797292448781658, 587330390893244126, 230969920480690813, 449580872786010504, 348530510280786937, 37686249256227644, 627149935393615967, 122752412872093949, 815715500153417802, 274102407891326859, 538101886675466795, 576606711993411922, 128191669821597321, 633119937599048836, 741273997400489702, 906689375348751249, 551656964663634561, 666284256367726953, 798473528862723536, 285360060772121661, 952572732392967611, 485959999082689644, 380666716274708715, 339422893599046129, 803559737065181831, 896016813818210275, 710096310295067287, 277470541764648573, 576030381968648, 98253830656104874, 318784121671397320, 614659427294269793, 702419170971347630, 525942534957319952};
int n = N, mark[N + 10];
ll base[M + 10], val[M + 10];
vector<int> vec;
bool ans[N + 10];
bool check(ll x) {
for (int j = M; j >= 0; j--)
if ((x & (1ll << j))) {
if (base[j])
x ^= base[j];
else {
bae[j] = x;
return false;
}
}
return true;
}
void add(ll x, int idx) {
ll tmp = (1ll << idx);
for (int j = M; j >= 0; j--)
if ((x & (1ll << j))) {
if (base[j]) {
x ^= base[j];
tmp ^= val[j];
}
else {
base[j] = x;
val[j] = tmp;
break;
}
}
}
ll make(ll x) {
ll tmp = 0;
for (int j = M; j >= 0; j--)
if ((x & (1ll << j))) {
if (base[j]) {
x ^= base[j];
tmp ^= val[j];
}
}
return tmp;
}
void defalt() {
for (int i = 0; i <= n; i++)
mark[i] = ans[i] = 0;
for (int j = 0; j <= M; j++)
base[j] = val[j] = 0;
vec.clear();
}
void Anna( int N, long long X, int K, int P[] ) {
n = N;
for (int i = 0; i < K; i++)
mark[P[i]] = true;
for (int i = 0; i < n; i++)
if (!mark[i] && !check(x[i]))
vec.push_back(i);
fill(base, base + M + 1, 0);
for (int i = 0; i < vec.size(); i++)
add(x[vec[i]], i);
ll res = make(X);
for (int i = 0; i < vec.size(); i++)
if ((res & (1ll << i)))
ans[vec[i]] = 1;
for (int i = 0; i < n; i++)
Set(i, ans[i]);
defalt();
}
#include "Brunolib.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 150;
const ll x[N] = {777523539921853505, 256004525803361772, 308305258728183102, 582745572890801791, 549292889148046381, 599698824668116389, 542111641530190889, 357772020071635407, 109402569541188054, 5878083635208241, 989597678449481750, 809250368948503439, 994344248487496567, 299171316159037239, 797555524300478742, 981313440474340818, 698135450199770811, 956964208817395377, 995831931848466817, 448359660972415504, 862423402299864600, 801814343641537265, 311781361602019705, 777734920438109133, 580938439913520741, 289987690178347392, 258668017375809564, 288091600886742779, 25908348031121769, 344387309598287137, 504165594281223965, 741731246967608369, 485614883627857654, 808024499261395942, 242536403939624977, 183068567155725681, 740803632367211547, 502531793125307201, 99586522124545388, 208300672617238699, 322313812028614563, 221289985247795252, 10326911613079258, 308066933530881736, 20744043878119823, 725293300288995213, 740793681085073577, 140507163506247369, 681835731921478784, 50242555061706965, 347922011874963235, 382391377047202806, 342007485918078953, 110910543544906163, 937585650047628937, 898831968258419494, 299760824468325089, 200901937990415314, 627493372067307581, 9335688382631275, 704891135349134354, 513228825447409702, 280767870337731883, 194631383138767250, 265412659824565020, 149204939291390483, 332437534371063328, 593083350677388403, 380739899631345380, 68981156002880522, 898847677530913978, 42188585005920551, 331973439114305435, 428101008952006083, 740448352331609582, 556818344531122135, 498449343713428533, 695980271928755861, 593880401288963563, 199139121099849226, 601187357705837908, 918392557402589838, 863159770020835672, 316526537369761786, 35259610614239594, 698824457564801534, 413180120839817472, 425967365239469353, 142139806994845389, 818256621045964533, 690385704471992311, 545208671095536136, 507108612721245324, 271988533132589082, 307230711328072850, 246932709923986578, 769179018881842644, 744667777884179957, 65828547078679205, 578658460393691384, 306085085535947297, 256043553073910205, 985346280769651961, 247676969122846339, 622116587239151596, 250641039455468296, 298346051710416720, 130509902683469539, 110941849253522407, 38885328767620420, 403351582171109415, 78248166236264673, 22170989365573794, 791685132468809429, 906111832624415828, 353814842702750221, 637797292448781658, 587330390893244126, 230969920480690813, 449580872786010504, 348530510280786937, 37686249256227644, 627149935393615967, 122752412872093949, 815715500153417802, 274102407891326859, 538101886675466795, 576606711993411922, 128191669821597321, 633119937599048836, 741273997400489702, 906689375348751249, 551656964663634561, 666284256367726953, 798473528862723536, 285360060772121661, 952572732392967611, 485959999082689644, 380666716274708715, 339422893599046129, 803559737065181831, 896016813818210275, 710096310295067287, 277470541764648573, 576030381968648, 98253830656104874, 318784121671397320, 614659427294269793, 702419170971347630, 525942534957319952};
long long Bruno( int N, int A[] ) {
ll ans = 0;
for (int i = 0; i < N; i++)
if (A[i])
ans ^= x[i];
return ans;
}