Submission #1610095
Source Code Expand
#include<bits/stdc++.h> using namespace std; unsigned K,M,A[100],C[100][100],Z[100][100]; void f(unsigned M[100][100]){ unsigned T[100][100]; for(int i=0;i<K;++i)for(int j=0;j<K;++j){ T[i][j]=0; } for(int i=0;i<K;++i)for(int j=0;j<K;++j)for(int k=0;k<K;++k){ T[i][j]^=Z[i][k]&M[k][j]; } for(int i=0;i<K;++i)for(int j=0;j<K;++j){ Z[i][j]=T[i][j]; } } main(){ cin>>K>>M; for(int i=0;i<K;++i)cin>>A[i]; for(int i=K;i--;)cin>>C[K-1][i]; for(int i=0;i<K-1;++i)C[i][i+1]=~0; for(int i=0;i<K;++i)Z[i][i]=~0; for(int s=32;s--;){ f(Z); if(M-1>>s&1)f(C); } unsigned x=0; for(int i=0;i<K;++i)x^=Z[0][i]&A[i]; cout<<x<<endl; }
Submission Info
Submission Time | |
---|---|
Task | D - 漸化式 |
User | x20 |
Language | C++14 (GCC 5.4.1) |
Score | 100 |
Code Size | 671 Byte |
Status | AC |
Exec Time | 44 ms |
Memory | 384 KB |
Judge Result
Set Name | All | ||
---|---|---|---|
Score / Max Score | 100 / 100 | ||
Status |
|
Set Name | Test Cases |
---|---|
All | random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, random_11.txt, random_12.txt, random_13.txt, random_14.txt, random_15.txt, sample_1.txt, sample_2.txt, sample_3.txt, small_1.txt, small_2.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
random_01.txt | AC | 1 ms | 256 KB |
random_02.txt | AC | 1 ms | 256 KB |
random_03.txt | AC | 1 ms | 256 KB |
random_04.txt | AC | 1 ms | 256 KB |
random_05.txt | AC | 1 ms | 256 KB |
random_06.txt | AC | 1 ms | 256 KB |
random_07.txt | AC | 3 ms | 256 KB |
random_08.txt | AC | 7 ms | 256 KB |
random_09.txt | AC | 42 ms | 384 KB |
random_10.txt | AC | 44 ms | 384 KB |
random_11.txt | AC | 44 ms | 384 KB |
random_12.txt | AC | 44 ms | 384 KB |
random_13.txt | AC | 44 ms | 384 KB |
random_14.txt | AC | 44 ms | 384 KB |
random_15.txt | AC | 39 ms | 384 KB |
sample_1.txt | AC | 1 ms | 256 KB |
sample_2.txt | AC | 1 ms | 256 KB |
sample_3.txt | AC | 2 ms | 256 KB |
small_1.txt | AC | 1 ms | 256 KB |
small_2.txt | AC | 1 ms | 256 KB |