/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 540.0 KiB
#2 Accepted 23ms 532.0 KiB
#3 Accepted 21ms 540.0 KiB
#4 Accepted 5ms 332.0 KiB
#5 Accepted 34ms 328.0 KiB
#6 Accepted 37ms 540.0 KiB
#7 Accepted 36ms 588.0 KiB

Code

#include<bits/stdc++.h>
using namespace std;
int main()
{

    int t;
    cin>>t;
    for(int i =0; i<t; i++)
    {
        int x,y;
        cin>>x>>y;
        set<int>a,b;
        for(int j = 0; j<x; j++){
            int aa;
            cin>>aa;
            a.insert(aa);
        }
        for(int j = 0; j<y; j++){
            int aa;
            cin>>aa;
            b.insert(aa);
        }
        bool possible =  true;
        for (int date = 1; date <= 31; ++date) {
            int tens = date / 10;
            int units = date % 10;

            if (a.find(tens) == a.end() || b.find(units) == b.end()) {
                possible = false;
                break;
            }
        }

        if(possible)
        {
            cout<<"YES"<<endl;
        }else{
        cout<<"NO"<<endl;
        }
    }
    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:09:13
Judged At
2025-01-02 15:09:13
Judged By
Score
100
Total Time
37ms
Peak Memory
588.0 KiB