Submission #143185

#TimeUsernameProblemLanguageResultExecution timeMemory
143185bupjae마술 (GCJ14_magic)C++17
6 / 6
3 ms504 KiB
#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 timeMemoryGrader output
Fetching results...