# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
8212 |
2014-09-07T04:59:18 Z |
gs14004 |
마술 (GCJ14_magic) |
C++ |
|
0 ms |
1208 KB |
#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 time |
Memory |
Grader output |
1 |
Correct |
0 ms |
1208 KB |
Output is correct |