# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
978264 | sleepntsheep | Broken Device (JOI17_broken_device) | C11 | 72 ms | 3020 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<string.h>
#include<stdlib.h>
typedef unsigned long long u64;
static u64 vecspace[150];
static void init() { for(int i=0;i<150;++i) vecspace[i]=rand()*1llu*rand(); }
u64 basis[64];
u64 basis_subtract[64][64], bo[64];
void basis_add(u64 x,int id)
{
u64 sub[64], so=0;
for(int j=60;j>=0;--j)
{
if(0==((x>>j)&1))
continue;
if (basis[j])
x ^= vecspace[sub[so++] = basis[j]];
else
{
sub[so++] = id;
basis[j] = id;
bo[j] = so;
memcpy(basis_subtract[j], sub, sizeof *sub * so);
}
}
}
void Anna( int N, long long X, int K, int P[] ){
srand(86868686u);
init();
int skillissue[150]={0};
for(int i=0;i<K;++i)skillissue[P[i]]=1;
for(int i=0;i<64;++i)basis[i]=0;
for(int i=0;i<150;++i)
{
if(skillissue[i])continue;
basis_add(vecspace[i], i);
}
int encoded[150]={0};
for(int j=60;j>=0;--j)
{
if(0==((X>>j)&1))
continue;
for(u64 i=0;i<bo[j];++i)
encoded[basis_subtract[j][i]] ^= 1;
}
for(int i=0;i<150;++i)
Set(i, encoded[i]);
}
#include "Brunolib.h"
#include<stdlib.h>
static unsigned long long vecspace[150];
static void init() { for(int i=0;i<150;++i) vecspace[i]=rand()*1llu*rand(); }
long long Bruno( int N, int A[] ){
srand(86868686u);
unsigned long long X=0;
for(int i=0;i<150;++i)
if(A[i]) X^=vecspace[i];
return X;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |