QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#468973#3013. XOR SequencesLVJBot1WA 1ms4096kbC++14861b2024-07-09 08:18:022024-07-09 08:18:02

Judging History

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

  • [2024-07-09 08:18:02]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:4096kb
  • [2024-07-09 08:18:02]
  • 提交

answer

/* Submission UUID: e2811ebd-0962-4ff7-ba41-ed3fcda715f9. */
#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;}

详细

Test #1:

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

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