/ SeriousOJ /

Record Detail

Time Exceeded


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 532.0 KiB
#2 Accepted 58ms 532.0 KiB
#3 Accepted 161ms 564.0 KiB
#4 Accepted 73ms 324.0 KiB
#5 Time Exceeded ≥1099ms ≥612.0 KiB
#6 Time Exceeded ≥1000ms ≥1.27 MiB

Code

#include <iostream>
#include <vector>
#include <set>
using namespace std;

bool ok(const vector<int>& l1, const vector<int>& l2) {
    set<int> s;

    for (int x : l1) 
    {
        for (int y : l2) 
        {
            int date = x * 10 + y;
            if (date >= 1 && date <= 31) 
            {
                s.insert(date);
            }
        }
    }
    return s.size() == 31;
}

int main()
{
    int t;
    cin >> t;

    while (t--) 
    {
        int n, m;
        cin >> n >> m;

        vector<int> l1(n), l2(m);
        for (int i = 0; i < n; i++)
        {
            cin >> l1[i];
        }
        for (int i = 0; i < m; i++) 
        {
            cin >> l2[i];
        }

        if (ok(l1, l2)) 
        {
            cout << "YES" << endl;
        } 
        else 
        {
            cout << "NO" << endl;
        }
    }

    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:21:23
Judged At
2025-01-02 15:21:23
Judged By
Score
50
Total Time
≥1099ms
Peak Memory
≥1.27 MiB