Wrong Answer
Code
#include <bits/stdc++.h>
using namespace std;
bool ok(const vector<int>& l1, const vector<int>& l2)
{
set<int> d1(l1.begin(), l1.end());
set<int> d2(l2.begin(), l2.end());
for (int i = 1; i <= 31; i++)
{
int tens = i / 10;
int units = i % 10;
if ((d1.count(tens) && d2.count(units)) || (d1.count(units) && d2.count(tens)))
{
continue;
}
else
{
return false;
}
}
return true;
}
int main()
{
int T;
cin >> T;
while (T--)
{
int N, M;
cin >> N >> M;
vector<int> l1(N), l2(M);
for (int i = 0; i < N; i++)
{
cin >> l1[i];
}
for (int i = 0; i < M; i++)
{
cin >> l2[i];
}
if (ok(l1, l2))
{
cout << "YES" << endl;
}
else
{
cout << "NO" << endl;
}
}
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:30:54
- Judged At
- 2025-01-02 15:30:54
- Judged By
- Score
- 0
- Total Time
- 23ms
- Peak Memory
- 540.0 KiB