/ SeriousOJ /

Record Detail

Time Exceeded


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 532.0 KiB
#2 Accepted 72ms 472.0 KiB
#3 Accepted 672ms 596.0 KiB
#4 Accepted 257ms 572.0 KiB
#5 Time Exceeded ≥1000ms ≥532.0 KiB
#6 Time Exceeded ≥1099ms ≥1.27 MiB

Code

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

#define ll long long
#define ld long double
#define MOD 1000000007
#define pie 2 * (acos(0.0))
#define yes cout << "YES\n"
#define no cout << "NO\n"
#define pb push_back
#define nl '\n'
#define lcm(a, b) (a * b) / (__gcd<ll>(a, b))
#define print(v)          \
    for (auto e : v)      \
        cout << e << " "; \
    cout << endl;
#define printp(v)    \
    for (auto e : v) \
        cout << e.first << " " << e.second << endl;
#define srt(v) sort(v.begin(), v.end())
#define rsrt(v) sort(v.rbegin(), v.rend())
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rrep(i, n) for (int i = (n) - 1; i >= 0; i--)
#define FOR(i, a, b) for (int i = (a); i <= (b); i++)
#define RFOR(i, a, b) for (int i = (a); i >= (b); i--)
#define trav(a, x) for (auto &a : x)
#define F first
#define S second
#define setbit(x) __builtin_popcount(x)
#define sz(x) (int)(x).size()
#define vi vector<int>
#define pi pair<int, int>
#define even(n) if (n % 2 == 0)
#define odd(n) if (n % 2 == 1)
#define sp << " " <<

#define alliswell                \
    ios::sync_with_stdio(false); \
    cin.tie(nullptr);

void solve()
{
    int a, b;
    cin >> a >> b;

    set<int> st;

    vi ar(a), arr(b);
    rep(i, a)
    {
        cin >> ar[i];
    }
    rep(i, b)
    {
        cin >> arr[i];
    }

    for (auto i : ar)
    {
        for (auto j : arr)
        {
            int d = i * 10 + j;
            st.insert(d);
        }
    }

    bool f = true;
    for (int i = 1; i <= 31; i++)
    {
        if (st.find(i) == st.end())
        {
            f = false;
            break;
        }
    }
    if (f)
        yes;
    else
        no;
}

int main()
{
    alliswell

        int t;
    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 14:56:18
Judged At
2025-01-02 14:56:18
Judged By
Score
50
Total Time
≥1099ms
Peak Memory
≥1.27 MiB