/ SeriousOJ /

Record Detail

Time Exceeded


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 532.0 KiB
#2 Accepted 73ms 576.0 KiB
#3 Accepted 678ms 576.0 KiB
#4 Accepted 260ms 576.0 KiB
#5 Time Exceeded ≥1000ms ≥532.0 KiB
#6 Time Exceeded ≥1000ms ≥1.27 MiB

Code

#include<bits/stdc++.h>
using namespace std;
#define getbit(n, i) (((n) & (1LL << (i))) != 0) 
#define setbit0(n, i) ((n) & (~(1LL << (i)))) 
#define setbit1(n, i) ((n) | (1LL << (i))) 

#define ll long long
template<typename s, typename t> void smax(s &a, const t &b) {if (a<b) a=b;}
template<typename s, typename t> void smin(s &a, const t &b) {if (a>b) a=b;}
char gap = 32;

#define rng_init mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
#define rng_seed(x) mt19937 rng(x)
#define fill(x, y) memset(x, y, sizeof(x))
#define srt(v) sort(v.begin(), v.end())
#define rsrt(v) sort(v.rbegin(),v.rend())
#define sum_v(v) accumulate(v.begin(), v.end(), 0)
#define pb push_back
#define lll __int128_t
ll hashPrime = 1610612741;

void solve(){
    int n, m;
    cin >> n >> m;
    vector<int>v(n);
    vector<int>b(m);
    for(int i=0; i<n; i++){
        cin >> v[i];
    }
    for(int i=0; i<m; i++){
        cin >> b[i];
    }
    set<int>st;
    for(auto x : v){
        for(auto y : b){
            int num=x*10+y;
            st.insert(num);
        }
    }
    for(int i=1; i<=31; i++){
        if(st.find(i)==st.end()){
            cout << "NO\n";
            return;
        }
    }
    cout << "YES\n";
}

signed main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int t; cin >> t;
    while(t--){
        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 16:21:12
Judged At
2025-01-02 16:21:12
Judged By
Score
50
Total Time
≥1000ms
Peak Memory
≥1.27 MiB