/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 536.0 KiB
#2 Wrong Answer 14ms 568.0 KiB
#3 Wrong Answer 10ms 532.0 KiB

Code

// Created on: 2025-01-02 20:40
// Author: Safwan_Ibrahim

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

#define ll long long
#define endl '\n'

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

    vector<int>a2(a.begin(), a.end());
    vector<int>b2(b.begin(), b.end());

    set<int>check;
    for (int i = 1; i <= 31; i++) {
        check.insert(i);
    }

    vector<int>ans;
    for (int i = 0; i < a2.size(); i++) {
        for (int j = 0; j < b2.size(); j++) {
            int num1 = a2[i] * 10 + b2[j], num2 = b2[j] * 10 + a2[i];
            if (check.find(num1) != check.end()) {
                check.erase(num1);
            }
            if (check.find(num2) != check.end()) {
                check.erase(num2);
            }
        }
    }
    cout << (check.size() == 0 ? "YES\n" : "NO\n");
    
}

int32_t main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int 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 15:08:26
Judged At
2025-01-02 15:08:26
Judged By
Score
0
Total Time
14ms
Peak Memory
568.0 KiB