#include <iostream>
using namespace std;
void main2() {
int v, w;
int d[17]{};
cin >> v;
for (int i = 1; i <= 4; i++) {
for (int j = 4; j > 0; j--) {
cin >> w;
if (i == v) d[w]++;
}
}
cin >> v;
for (int i = 1; i <= 4; i++) {
for (int j = 4; j > 0; j--) {
cin >> w;
if (i == v) d[w]++;
}
}
v = 0;
for (int i = 16; i > 0; i--) {
if (d[i] == 2) {
if (v != 0) {
cout << "Bad magician!";
return;
}
v = i;
}
}
if (v == 0) {
cout << "Volunteer cheated!";
} else {
cout << v;
}
}
int main() {
int t;
cin >> t;
for (int i = 1; i <= t; i++) {
cout << "Case #" << i << ": ";
main2();
cout << "\n";
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
504 KB |
Output is correct |