/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 540.0 KiB
#2 Accepted 8ms 588.0 KiB
#3 Accepted 10ms 556.0 KiB
#4 Accepted 2ms 772.0 KiB
#5 Accepted 18ms 540.0 KiB
#6 Accepted 14ms 560.0 KiB
#7 Accepted 13ms 564.0 KiB

Code

#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
using namespace std;

int main(){
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t;
    cin >> t;
    while (t--){
        int n, m, x, y = 0, z = 0, f = 0;
        cin >> n >> m;
        vector<int> a(10), b(10);
        for (int i = 0; i < n; i++){
            cin >> x;
            a[x] = 1;
        }
        for (int i = 0; i < m; i++){
            cin >> x;
            b[x] = 1;
        }
        y = z = 0;
        for (int i = 0; i < 10; i++){
            y += b[i];
            if (i < 4) z += a[i];
        }
        if (y == 10 && z == 4) f = 1;
        cout << (f? "YES" : "NO") << endl;
    }
}

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:59:21
Judged At
2025-01-02 14:59:21
Judged By
Score
100
Total Time
18ms
Peak Memory
772.0 KiB