Accepted
Code
#include <bits/stdc++.h>
using i64 = long long;
void solve() {
int n, m;
std::cin >> n >> m;
int a = 0, b = 0;
for (int i = 0; i < n; i++) {
int x;
std::cin >> x;
a |= 1 << x;
}
for (int i = 0; i < m; i++) {
int x;
std::cin >> x;
b |= 1 << x;
}
if (((a & 0b1111) == 0b1111) && (b + 1 == (1 << 10))) {
std::cout << "YES\n";
} else {
std::cout << "NO\n";
}
}
int main() {
std::ios::sync_with_stdio(false);
std::cin.tie(nullptr);
std::cout.tie(nullptr);
int t;
std::cin >> t;
while (t--) {
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:50
- Judged At
- 2025-01-02 14:36:50
- Judged By
- Score
- 100
- Total Time
- 13ms
- Peak Memory
- 560.0 KiB