Submission #8222

# Submission time Handle Problem Language Result Execution time Memory
8222 2014-09-07T06:16:05 Z ansol4328 마술 (GCJ14_magic) C++
0 / 6
0 ms 1088 KB
#include<stdio.h>

int main()
{
int i, j, k, n, a, m[6][6], cnt, out;
int list[4][6];

scanf("%d",&n);
for(k=1 ; k<=n ; k++)
{
cnt=0;
scanf("%d",&a);
for(i=1 ; i<=4 ; i++)
{
for(j=1 ; j<=4 ; j++)
{
scanf("%d",&m[i][j]);
if(i==a) list[1][j]=m[i][j];
}
}
scanf("%d",&a);
for(i=1 ; i<=4 ; i++)
{
for(j=1 ; j<=4 ; j++)
{
scanf("%d",&m[i][j]);
if(i==a) list[2][j]=m[i][j];
}
}
for(i=1 ; i<=4 ; i++) for(j=1 ; j<=4 ; j++) if(list[1][i]==list[2][j]) out=list[1][i], cnt++;
if(cnt==0) printf("Case #%d: Volunteer cheated!\n",i);
if(cnt==1) printf("Case #%d: %d\n",i,out);
if(cnt>=2) printf("Case #%d: Bad magician!\n",i);
}
return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 1088 KB Output isn't correct