Submission #159747

#TimeUsernameProblemLanguageResultExecution timeMemory
159747geon040702딱지놀이 (KOI17_card)C++14
100 / 100
12 ms568 KiB
#include <bits/stdc++.h>
using namespace std;

int N, a;
int A[5];
int B[5];

int main(void)
{
    int i, j, x;

    for(j=0;j<5;j++) {
        A[j] = 0;
        B[j] = 0;
    }

    scanf("%d", &N);

    for(i=0;i<N;i++) {
        scanf("%d", &a);
        for(j=0;j<a;j++) {
            scanf("%d", &x);
            A[x]+=1;
        }

        scanf("%d", &a);
        for(j=0;j<a;j++) {
            scanf("%d", &x);
            B[x]+=1;
        }

        for(j=4;j>=0;j--) {
            if(j == 0) {
                printf("D\n");
                break;
            }
            if(A[j] != B[j]) {
                if(A[j] > B[j]) {
                    printf("A\n");
                    break;
                }
                else {
                    printf("B\n");
                    break;
                }
            }
        }

        for(j=0;j<5;j++) {
            A[j] = 0;
            B[j] = 0;
        }
    }

    return 0;
}

Compilation message (stderr)

card.cpp: In function 'int main()':
card.cpp:17:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d", &N);
     ~~~~~^~~~~~~~~~
card.cpp:20:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d", &a);
         ~~~~~^~~~~~~~~~
card.cpp:22:18: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
             scanf("%d", &x);
             ~~~~~^~~~~~~~~~
card.cpp:26:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d", &a);
         ~~~~~^~~~~~~~~~
card.cpp:28:18: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
             scanf("%d", &x);
             ~~~~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...