/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 0ms 284.0 KiB
#2 Accepted 7ms 432.0 KiB
#3 Accepted 7ms 284.0 KiB
#4 Accepted 2ms 284.0 KiB
#5 Accepted 18ms 508.0 KiB
#6 Accepted 19ms 1.02 MiB
#7 Accepted 19ms 1.02 MiB

Code

#include<stdio.h>
int main()
{
    int t;
    long int n, m;
    scanf("%d",&t);
    while(t--){
        scanf("%ld %ld",&n, &m);
        int fl[n], sl[m], fre1[10]={0}, fre2[10]={0};
        for(int i=0;i<n;i++){
            scanf("%d",&fl[i]);
            fre1[fl[i]]++;
        }
        //second list
        for(int i=0;i<m;i++){
            scanf("%d",&sl[i]);
            fre2[sl[i]]++;
        }

        int fdate=1;
        for(int i=1;i<=31;i++){
            int fr1=i/10;
            int fr2=i%10;
            if(fre1[fr1]==0 || fre2[fr2]==0){
                fdate=0;
                break;
            }
        }

        if(fdate){
            printf("YES\n");
        }
        else{
            printf("NO\n");
        }

    }
    return 0;
}

Information

Submit By
Type
Submission
Problem
P1153 Is Date Possible?
Contest
Happy New Year 2025
Language
C++17 (G++ 13.2.0)
Submit At
2025-01-02 15:10:18
Judged At
2025-01-02 15:10:18
Judged By
Score
100
Total Time
19ms
Peak Memory
1.02 MiB