Accepted
Code
#include <bits/stdc++.h>
using namespace std;
// #include "debug.h"
void solve() {
int n, m;
cin >> n >> m;
set<int> a, b;
for (int i = 0; i < n; ++i) {
int x;
cin >> x;
a.insert(x);
}
for (int i = 0; i < m; ++i) {
int x;
cin >> x;
b.insert(x);
}
for (int i = 0; i <= 3; ++i) {
for (int j = (i == 0 ? 1 : 0); j <= (i == 3 ? 1 : 9); ++j) {
if (!a.count(i) || !b.count(j)) {
cout << "NO\n";
return;
}
}
}
cout << "YES\n";
}
int32_t main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
int tc = 1;
cin >> tc;
while (tc--) {
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 14:36:31
- Judged At
- 2025-01-02 14:36:31
- Judged By
- Score
- 100
- Total Time
- 40ms
- Peak Memory
- 764.0 KiB