/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 532.0 KiB
#2 Accepted 11ms 464.0 KiB
#3 Accepted 10ms 532.0 KiB
#4 Accepted 3ms 532.0 KiB
#5 Accepted 17ms 532.0 KiB
#6 Accepted 18ms 2.02 MiB
#7 Accepted 19ms 2.023 MiB

Code

// Author: Gourav Preet Gupta
// Language: C++

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

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define Max(x,y,z) max(x,max(y,z))
#define Min(x,y,z) min(x,min(y,z))
#define pb push_back
#define ppb pop_back
#define eb emplace_back
#define mp make_pair
#define float long double
#define yes  cout << "YES" << endl;
#define no  cout << "NO" << endl;
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define PI 3.141592653589793
#define Mod 1000000007

typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<long long> vll;
typedef vector<vll> vvll;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<pair<int,int> > vpii;
typedef vector<pair<long long,long long> > vpll;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef priority_queue<ll> pq;
typedef priority_queue<pair<ll,ll> > pqp;

template<typename T> T gcd(T a,T b) { if(a==0) return b; return gcd(b%a,a); }
template<typename T> T pow(T a,T b, ll m){T ans=1; while(b>0){ if(b%2==1) ans=(ans*a)%m; b/=2; a=(a*a)%m; } return ans%m; }

/*
****************************************LOVE YOU MAA***************************************************
**********************************FAMILY ABOVE ALL*****************************************************
**************************************GIVE ME SOME SUNSHINE , GIVE ME SOME RAIN************************
******************************GIVE ME ANOTHER CHANCE , I WANNA GROW UP ONCE AGAIN**********************
**************************************YE DIL MAANGE MORE***********************************************
**************************SHAURYAM DAKSHAM YUDDHE,BALIDAAN PARAM DHARMA********************************
*/

// Never Stop Trying.
// Trying to be Better than Myself.
 
// while(true)
// {
//     if(AC)
//     {
//         break;
//     }
//     else if(Contest Over)
//     {
//         Try.
//         Check out Editorial.
//         Understand.
//         Find out your Mistake.
//         Learn the topic (if new).
//         Solve Problems on that topic (if new).
//         Upsolve that problem.
//         break;
//     }
//     else
//     {
//         Try.
//         Use Pen-Paper.
//         Find errors, edge cases, etc.
//         continue;
//     }
// }

//Remember,mazaa journey mein jyaada hai,manzil main utna nahi....

const int N=1e5+5;

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

    set<ll> st1 , st2;
    for(ll i=0; i<n; i++)
    {
        cin>>v1[i];
        st1.insert(v1[i]);
    }

    for(ll i=0; i<m; i++)
    {
        cin>>v2[i];
        st2.insert(v2[i]);
    }

    bool flag1 = true, flag2 = true;

    for(ll i=0; i<=3; i++)
    {
        if(st1.find(i)==st1.end())
        {
            flag1 = false;
            break;
        }
    }

    for(ll i=0; i<=9; i++)
    {
        if(st2.find(i)==st2.end())
        {
            flag2 = false;
            break;
        }
    }

    if(flag1 && flag2)
    yes 
    else 
    no
     
}

int main()
{    
    IOS;
    
    ll t;
    cin>>t;
    while(t--)
    {
        solve();
    }

    return 0;
}

Information

Submit By
Type
Submission
Problem
P1153 Is Date Possible?
Language
C++17 (G++ 13.2.0)
Submit At
2025-01-04 07:23:53
Judged At
2025-01-04 07:23:53
Judged By
Score
100
Total Time
19ms
Peak Memory
2.023 MiB