Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
38007 | LYLAKIOIAKIOI | 【S】T3 | C++ | 解答错误 | 10 | 291 MS | 8272 KB | 1521 | 2025-06-08 16:22:58 |
#include<bits/stdc++.h> #define ll long long #define pii pair<int,int> #define pll pair<ll,ll> #define mk make_pair #define fi first #define se second using namespace std; const int N=1e6; int n,m,k; ll a[N],pw[10]; ll t1[N],t2[N]; int main(){ cin>>n>>k;m=powl(k+1,n); for(int i=0;i<m;i++) cin>>a[i]; pw[0]=1;for(int i=1;i<=n;i++) pw[i]=pw[i-1]*(k+1); for(int i=0;i<n;i++){ for(int j=0;j<m;j++){ if((j/pw[i])%k!=0) continue; for(int x=0;x<=k;x++) t1[x]=a[j+pw[i]*x]; if(k==3){ t2[0]=t1[0]-t1[2]+t1[3]; t2[1]=t1[2]-t1[3]; t2[2]=t1[1]-t1[0]; t1[3]=t1[3]-t1[1]+t1[0]; }else if(k==5){ t2[0]=t1[1]+t1[4]-t1[2]-t1[5]; t2[1]=t1[2]+t1[5]+t1[0]-t1[1]-t1[4]; t2[2]=t1[1]-t1[0]; t2[3]=t1[4]-t1[5]; t2[4]=t1[3]+t1[5]+t1[0]-t1[1]-t1[4]; t2[5]=t1[1]+t1[4]-t1[3]-t1[0]; }else{ t2[0]=t1[0]+t1[3]+t1[6]-t1[2]-t1[5]; t2[1]=t1[2]+t1[5]-t1[6]-t1[3]; t2[2]=t1[1]-t1[0]; t2[3]=t1[3]+t1[0]+t1[6]-t1[1]-t1[5]; t2[4]=t1[5]-t1[6]; t2[5]=t1[4]+t1[1]-t1[0]-t1[3]; t2[6]=t1[0]+t1[3]+t1[6]-t1[1]-t1[4]; } for(int x=0;x<=k;x++) a[j+pw[i]*x]=t2[x]; } }for(int i=0;i<m;i++) cout<<a[i]<<' ';cout<<endl; return 0; }