# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
21112 |
2017-04-04T17:15:48 Z |
yunhoo90 |
마술 (GCJ14_magic) |
C++11 |
|
0 ms |
2020 KB |
#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;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
2020 KB |
Output is correct |