/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 532.0 KiB
#2 Wrong Answer 13ms 532.0 KiB
#3 Accepted 10ms 532.0 KiB
#4 Accepted 4ms 532.0 KiB
#5 Accepted 33ms 532.0 KiB
#6 Accepted 16ms 532.0 KiB
#7 Accepted 17ms 324.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> una, unb;
    bool hz=false;
    for (int i = 0; i < n; i++) {
        int x;
        cin >> x;
        if(x==0)hz=true;
        una.insert(x);
    }
    for (int i = 0; i < m; i++) {
        int x;
        cin >> x;
        if(x==0)hz=true;
        unb.insert(x);
    }
    int sum1=0,sum2=0;
    for(auto &it: una)sum1+=it;
    for(auto &it: unb)sum2+=it;

    // bool possible = true;
    // for (int i = 1; i <= 31; i++) {
    //     int f = i / 10;
    //     int s = i % 10;
    //     if ((una.find(f) != una.end() && unb.find(s) != unb.end()) ||
    //         (unb.find(f) != unb.end() && una.find(s) != una.end())) {
    //         continue;
    //     } else {
    //         possible = false;
    //         break;
    //     }
    // }

    if (sum1==45 && sum2==45 && hz) {
        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:15:30
Judged At
2025-01-02 15:15:30
Judged By
Score
80
Total Time
33ms
Peak Memory
532.0 KiB