#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <list>
#include <memory.h>
using namespace std;
int map[4][4];
int row[4];
void input() {
for (int i = 0; i < 4; i++) {
for (int j = 0; j < 4; j++)
cin >> map[i][j];
}
}
int main() {
int tc;
cin >> tc;
for(int cas = 1;cas <=tc; cas++) {
int cnt = 0;
int ans;
int r;
cin >> r;
input();
for (int i = 0; i < 4; i++)
row[i] = map[r - 1][i];
cin >> r;
input();
for (int i = 0; i < 4; i++) {
for (int j = 0; j < 4; j++) {
if (map[r - 1][i] == row[j]) {
ans = map[r - 1][i];
cnt++;
}
}
}
printf("Case #%d: ", cas);
switch (cnt)
{
case 0:
cout << "Volunteer cheated!" << endl;
break;
case 1:
cout << ans << endl;
break;
default:
cout << "Bad magician!" << endl;
break;
}
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
2020 KB |
Output is correct |