# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1113124 | ttamx | Broken Device (JOI17_broken_device) | C++17 | 59 ms | 2712 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>
using namespace std;
void Anna(int n,long long x,int k,int p[]){
mt19937_64 rng(0);
vector<uint64_t> basis(64),way(64);
vector<int> id(64,-1);
auto add=[&](uint64_t x,int i){
uint64_t w=0;
for(int b=63;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++){
uint64_t val=rng();
if(ok[i]){
add(val,i);
}
}
vector<int> ans(n);
uint64_t w=0;
for(int i=63;i>=0;i--){
if(x>>i&1){
x^=basis[i];
w^=way[i];
}
}
for(int i=63;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 time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |