/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 532.0 KiB
#2 Accepted 22ms 344.0 KiB
#3 Accepted 18ms 536.0 KiB
#4 Accepted 5ms 320.0 KiB
#5 Accepted 35ms 532.0 KiB
#6 Accepted 34ms 544.0 KiB
#7 Accepted 34ms 328.0 KiB

Code

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

int main() {

    int t; cin >> t;

    while(t--){

        int n, m; cin >> n >> m;
        set<int> st1, st2;
        int num;

        for(int i = 0; i < n; i++) {
            cin >> num;
            st1.insert(num);
        }

        for(int i = 0; i < m; i++) {
            cin >> num;
            st2.insert(num);
        }

        //first digit set must have values 0-3 and second digit set must have values (0-9)
        bool check = false;
        for(int i = 0; i <= 3; i++) {

            if(st1.find(i) == st1.end() || st2.size() < 10) {
                cout << "NO\n";
                check = true;
                break;
            } 
        }

        //After checking all conditions in the for loop if check != true then all ok
        if(!check) cout << "YES\n";
    }
  
  return 0;
}

Information

Submit By
Type
Submission
Problem
P1153 Is Date Possible?
Language
C++17 (G++ 13.2.0)
Submit At
2025-01-11 08:53:29
Judged At
2025-01-11 08:53:29
Judged By
Score
100
Total Time
35ms
Peak Memory
544.0 KiB