#include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;
int tc,i;
void process(){
int c1,c2,t,cnt = 0, val;
scanf("%d",&c1);
vector<int> v;
for (int i=0; i<4; i++) {
for (int j=0; j<4; j++) {
scanf("%d",&t);
if(i+1 == c1) v.push_back(t);
}
}
scanf("%d",&c2);
for (int i=0; i<4; i++) {
for (int j=0; j<4; j++) {
scanf("%d",&t);
if(i+1 == c2 && find(v.begin(),v.end(),t) != v.end()){
cnt++;
val = t;
}
}
}
printf("Case #%d: ",i+1);
if(cnt == 0) puts("Volunteer cheated!");
else if(cnt > 1) puts("Bad magician!");
else printf("%d\n",val);
}
int main(){
scanf("%d",&tc);
for (i=0; i<tc; i++) {
process();
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
1208 KB |
Output is correct |