/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 764.0 KiB
#2 Accepted 11ms 532.0 KiB
#3 Accepted 9ms 536.0 KiB
#4 Accepted 3ms 536.0 KiB
#5 Accepted 25ms 532.0 KiB
#6 Accepted 40ms 532.0 KiB
#7 Accepted 17ms 532.0 KiB

Code

#include <bits/stdc++.h>

using namespace std;

// #include "debug.h"

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

        set<int> a, b;
        for (int i = 0; i < n; ++i) {
                int x;
                cin >> x;
                a.insert(x);
        }
        for (int i = 0; i < m; ++i) {
                int x;
                cin >> x;
                b.insert(x);
        }

        for (int i = 0; i <= 3; ++i) {
                for (int j = (i == 0 ? 1 : 0); j <= (i == 3 ? 1 : 9); ++j) {
                        if (!a.count(i) || !b.count(j)) {
                                cout << "NO\n";
                                return;
                        }
                }
        }

        cout << "YES\n";
}

int32_t main() {
        ios_base::sync_with_stdio(false);
        cin.tie(0);

        int tc = 1;
        cin >> tc;

        while (tc--) {
                solve();
        }
}

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:36:31
Judged At
2025-01-02 14:36:31
Judged By
Score
100
Total Time
40ms
Peak Memory
764.0 KiB