QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#469016#3013. XOR SequencesLVJBot1WA 1ms4280kbC++14861b2024-07-09 10:03:592024-07-09 10:04:00

Judging History

你现在查看的是最新测评结果

  • [2024-07-09 10:04:00]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:4280kb
  • [2024-07-09 10:03:59]
  • 提交

answer

/* Submission UUID: f15f6386-4fc3-4643-a319-105393097f01. */
#include<bits/stdc++.h>
#define int long long
using namespace std;const int N=105,Mod=1e9+7;struct Matrix{int n,m,a[N][N];Matrix(int x,int y,bool I=0){n=x,m=y,memset(a,0,sizeof(a));for(int i=1;i<=n&&I;i++)a[i][i]=1;}Matrix operator*(Matrix&b){Matrix c(n,b.m);for(int i=1;i<=n;i++)for(int j=1;j<=b.m;j++)for(int k=1;k<=m;k++)(c[i][j]+=a[i][k]*b[k][j])%=Mod;return c;}int*operator[](int x){return a[x];}};Matrix qpow(Matrix a,int k){Matrix res(a.n,a.m,1);while(k){if(k&1)res=res*a;a=a*a,k>>=1;}return res;}long long n,m,ans;int a[N];signed main(){cin>>n>>m;Matrix f(n,1),b(n,n);for(int i=1;i<=n;i++)cin>>a[i],f[i][1]=1;for(int i=1;i<=n;i++)for(int j=1;j<=n;j++){int cnt=__builtin_popcountll(a[i]^a[j]);if(cnt%3==0)b[i][j]=1;}f=qpow(b,m-1)*f;for(int i=1;i<=n;i++)(ans+=f[i][1])%=Mod;cout<<ans;return 0;}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 4280kb

input:

4 12
2
2
3
6
1
12
1
12
9
7
5
5
4
8
10
11

output:

4098

result:

wrong answer expected 8, found 4098