/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 540.0 KiB
#2 Accepted 13ms 588.0 KiB
#3 Accepted 9ms 540.0 KiB
#4 Accepted 3ms 540.0 KiB
#5 Accepted 18ms 796.0 KiB
#6 Accepted 20ms 1.969 MiB
#7 Accepted 20ms 2.082 MiB

Code

/* 
*   @author:- SYEDA SADIATUL JANNAT TUSHI
*   date & time :2025-01-02 20:29:39
*   BANGLADESH , SYLHET. 
*/

#include <bits/stdc++.h>
using namespace std;

#define endl          '\n'
#define ll            long long
#define vi            vector<ll>
#define pii           pair<ll,ll>
#define vii           vector<pii>
#define sz(x)         (int)x.size()
#define be(x)         x.begin(), x.end()
#define srt(v)         sort(v.begin(),v.end())
#define rsrt(v)        sort(v.rbegin(),v.rend())
#define fl(i, a, b)   for(ll i = (a); i < (b); i++)
#define print(v)      for(auto e:v) cout<<e<<" "; cout<<endl;
#define InShaAllah    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

void solve() {
    ll n,m;
    cin>> n >>m;

    vi a(n),b(m);

    set<ll>aa;
    set<ll>bb;

    fl(i,0,n){
        cin>> a[i];
        aa.insert(a[i]);
    }
    fl(i,0,m){
        cin>> b[i];
        bb.insert(b[i]);
    }

    bool ok=true;
    bool okk=true;

    fl(i,1,31){
        if(aa.count(i / 10) == 0){
            ok=false;
        }
        if(bb.count(i%10) == 0){
            okk=false;
        }
    }

    if(ok && okk){
        cout << "YES" <<endl;
        cout<< endl;
    }
    else{
        cout<< "NO" <<endl;
        cout<<endl;
    }
}

int main() {
    InShaAllah
    ll t = 1;
    cin >> t;

    while (t--) {
        solve();
    }
    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 14:57:51
Judged At
2025-01-02 14:57:51
Judged By
Score
100
Total Time
20ms
Peak Memory
2.082 MiB