Submission #978259

#TimeUsernameProblemLanguageResultExecution timeMemory
978259sleepntsheepBroken Device (JOI17_broken_device)C11
0 / 100
1 ms604 KiB
#include "Annalib.h" #include<string.h> #include<stdlib.h> typedef unsigned long long u64; u64 vecspace[150]; 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(u64 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(u64 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> unsigned long long vecspace[150]; 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; }
#Verdict Execution timeMemoryGrader output
Fetching results...