/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 532.0 KiB
#2 Accepted 11ms 532.0 KiB
#3 Accepted 10ms 532.0 KiB
#4 Accepted 3ms 532.0 KiB
#5 Accepted 18ms 532.0 KiB
#6 Accepted 15ms 532.0 KiB
#7 Accepted 15ms 320.0 KiB

Code

// Author: Shawn Das Shachin-->(shawn_das)

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define pb push_back
#define mod 1000000007
#define srt(v) sort(v.begin(),v.end())
#define rsrt(v) sort(v.rbegin(),v.rend())
#define OPTIMIZE_IO ios::sync_with_stdio(false); cin.tie(nullptr);

void solve(){
    int n, m;
    cin >> n >> m;
    set<int> unb;
    bool hz1=false,hz2=false,h1=false,h2=false,h3=false;
    for (int i = 0; i < n; i++) {
        int x;
        cin >> x;
        if(x==0)hz1=true;
        if(x==1)h1=true;
        if(x==2)h2=true;
        if(x==3)h3=true;
        
        else continue;
    }
    for (int i = 0; i < m; i++) {
        int x;
        cin >> x;
        if(x==0)hz2=true;
        unb.insert(x);
    }
    int sum=0;

    for(auto &it: unb)sum+=it;

    if (sum==45 && hz1 && hz2 && h1 && h2 && h3) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }
}

int main() {
    OPTIMIZE_IO;
    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 15:45:48
Judged At
2025-01-02 15:45:48
Judged By
Score
100
Total Time
18ms
Peak Memory
532.0 KiB