Submission #978282

#TimeUsernameProblemLanguageResultExecution timeMemory
978282sleepntsheepBroken Device (JOI17_broken_device)C11
0 / 100
260 ms3404 KiB
#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()*1llu*rand(); } u64 basis[64]; int basis_toggle[64][110]; int map[150], rvmap[110]; void basis_add(u64 x,int id) { int toggle[110]={0}; toggle[id] = 1; for(int j=60;j>=0;--j) { if(0==((x>>j)&1)) continue; if (basis[j]) { for (int k=0;k<110;++k) toggle[k] ^= basis_toggle[j][k]; x ^= basis[j]; } else { basis[j] = x; memcpy(basis_toggle[j], toggle, sizeof toggle); } } } 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; int c1=0; for(int i=0;i<150;++i) { if(skillissue[i]==0)map[i]=c1,rvmap[c1]=i,++c1; } for(int i=0;i<64;++i)basis[i]=0; for(int i=0;i<150;++i) { if(map[i]>=110)continue; if(skillissue[i])continue; basis_add(vecspace[i], map[i]); } int encode[150]={0}; for(int j=60;j>=0;--j) { if(0==((X>>j)&1)) continue; X ^= basis[j]; for(int k=0;k<110;++k) encode[rvmap[k]] ^= basis_toggle[j][k]; } for(int i=0;i<150;++i) Set(i,encode[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); init(); 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...