Submission #8212

#TimeUsernameProblemLanguageResultExecution timeMemory
8212gs14004마술 (GCJ14_magic)C++98
6 / 6
0 ms1208 KiB
#include <cstdio> #include <vector> #include <algorithm> using namespace std; int tc,i; void process(){ int c1,c2,t,cnt = 0, val; scanf("%d",&c1); vector<int> v; for (int i=0; i<4; i++) { for (int j=0; j<4; j++) { scanf("%d",&t); if(i+1 == c1) v.push_back(t); } } scanf("%d",&c2); for (int i=0; i<4; i++) { for (int j=0; j<4; j++) { scanf("%d",&t); if(i+1 == c2 && find(v.begin(),v.end(),t) != v.end()){ cnt++; val = t; } } } printf("Case #%d: ",i+1); if(cnt == 0) puts("Volunteer cheated!"); else if(cnt > 1) puts("Bad magician!"); else printf("%d\n",val); } int main(){ scanf("%d",&tc); for (i=0; i<tc; i++) { process(); } }
#Verdict Execution timeMemoryGrader output
Fetching results...