Submission #1113122

#TimeUsernameProblemLanguageResultExecution timeMemory
1113122ttamxBroken Device (JOI17_broken_device)C++17
0 / 100
57 ms2856 KiB
#include "Annalib.h" #include<bits/stdc++.h> using namespace std; void Anna(int n,long long x,int k,int p[]){ mt19937_64 rng(0); vector<uint64_t> basis(64); vector<int> id(64,-1); auto add=[&](uint64_t x,int i){ for(int b=63;b>=0;b--){ if(x>>b&1){ if(id[b]==-1){ basis[b]=x; id[b]=i; return; } x^=basis[b]; } } }; vector<bool> ok(n,true); for(int i=0;i<k;i++){ ok[p[i]]=false; } for(int i=0;i<n;i++){ uint64_t val=rng(); if(ok[i]){ add(val,i); } } vector<int> ans(n); for(int i=63;i>=0;i--){ if(x>>i&1){ x^=basis[i]; 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...