Submission #15262

#TimeUsernameProblemLanguageResultExecution timeMemory
15262ggoh쿼터너리 컴퓨터 (kriii3_Z)C++98
31 / 126
4000 ms1092 KiB
#include<cstdio> #include<algorithm> #include<vector> #include<cmath> int pl[4][4]={0,1,2,3,1,2,3,0,2,3,0,1,3,0,1,2},xo[4][4]={0,1,2,3,1,0,3,2,2,3,0,1,3,2,1,0}; int a,b,i,j,U,p,q,v[19],x[444],y[444],z[444],ch[444],T,fl[19],ss[19]; main() { scanf("%d%d",&a,&b); for(i=0;i<a;i++) { scanf("%d",&fl[i]); } for(i=0;i<b;i++) { scanf("%d%d%d%d",&ch[i],&x[i],&y[i],&z[i]); } T=1; for(i=0;i<a;i++)T*=3; for(i=0;i<T;i++) { U=i; for(j=0;j<a;j++) { p=U%3-1; q=0; if(fl[j]==q)q++; for(;p>=0;p--) { q++; if(fl[j]==q)q++; } v[j]=q; U/=3; } for(j=0;j<b;j++) { if(ch[j]==0)v[x[j]]=pl[v[y[j]]][v[z[j]]]; else if(ch[j]==1)v[x[j]]=xo[v[y[j]]][v[z[j]]]; else if(ch[j]==2)v[x[j]]=pl[v[y[j]]][z[j]]; else v[x[j]]=xo[v[y[j]]][z[j]]; } for(j=0;j<a;j++)ss[j]+=v[j]; } for(i=0;i<a;i++)printf("%d ",ss[i]%4); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...