Submission #1113126

#TimeUsernameProblemLanguageResultExecution timeMemory
1113126ttamxBroken Device (JOI17_broken_device)C++17
0 / 100
48 ms2792 KiB
#include "Annalib.h" #include<bits/stdc++.h> using namespace std; void Anna(int n,long long x,int k,int p[]){ using ull = uint64_t; mt19937_64 rng(0); vector<ull> basis(40),way(40); vector<int> id(40,-1); auto add=[&](ull x,int i){ ull w=0; for(int b=39;b>=0;b--){ if(x>>b&1){ if(id[b]==-1){ basis[b]=x; way[b]=w|(1ULL<<b); id[b]=i; return; } x^=basis[b]; w^=way[b]; } } }; vector<bool> ok(n,true); for(int i=0;i<k;i++){ ok[p[i]]=false; } for(int i=0;i<n;i++){ ull val=rng(); if(ok[i]){ add(val,i); } } vector<int> ans(n); ull w=0; for(int i=39;i>=0;i--){ if(x>>i&1){ x^=basis[i]; w^=way[i]; } } for(int i=39;i>=0;i--){ if(w>>i&1){ ans[id[i]]=1; } } for(int i=0;i<n;i++){ Set(i,ans[i]); } }
#include "Brunolib.h" #include<bits/stdc++.h> using namespace std; long long Bruno(int n,int a[]){ mt19937_64 rng(0); uint64_t ans=0; for(int i=0;i<n;i++){ uint64_t val=rng(); if(a[i]){ ans^=val; } } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...