Submission #8211

# Submission time Handle Problem Language Result Execution time Memory
8211 2014-09-07T04:58:55 Z gs14004 마술 (GCJ14_magic) C++
0 / 6
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 Incorrect 0 ms 1208 KB Output isn't correct