# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
143185 |
2019-08-13T09:55:12 Z |
bupjae |
마술 (GCJ14_magic) |
C++17 |
|
3 ms |
504 KB |
#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";
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
504 KB |
Output is correct |