/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 532.0 KiB
#2 Accepted 7ms 532.0 KiB
#3 Accepted 7ms 532.0 KiB
#4 Accepted 2ms 532.0 KiB
#5 Accepted 15ms 532.0 KiB
#6 Accepted 16ms 328.0 KiB
#7 Accepted 18ms 532.0 KiB

Code

#include <bits/stdc++.h>
#define ll long long
#define endl '\n'

using namespace std;

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);

	int tt; cin >> tt;
	while (tt--) {
		int n, m;  cin >> n >> m;
		vector<int> a(11, 0), b(11, 0);
		int x;
		for (int i = 0; i < n; i++) {
			cin >> x;
			a[x] = 1;
		}

		for (int i = 0; i < m; i++) {
			cin >> x;
			b[x] = 1;
		}

		if (a[0] == 0 || a[1] == 0 || a[2] == 0 || a[3] == 0) cout << "NO\n";
		else {
			x = 0;
			for (int i = 0; i < 10; i++) {
				if (b[i] == 0) {
					x = 1;
					break;
				}
			}

			if (x) cout << "NO\n";
			else cout << "YES\n";
		}
	}

	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 14:43:54
Judged At
2025-01-02 14:43:54
Judged By
Score
100
Total Time
18ms
Peak Memory
532.0 KiB