Submission #21112

#TimeUsernameProblemLanguageResultExecution timeMemory
21112yunhoo90마술 (GCJ14_magic)C++11
6 / 6
0 ms2020 KiB
#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; }

Compilation message (stderr)


#Verdict Execution timeMemoryGrader output
Fetching results...