0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-11-08 14:58:48 +00:00

C - Two Arrays

https://codeforces.com/contest/1589/submission/135373583
This commit is contained in:
Baoshuo Ren 2021-11-14 15:13:46 +08:00 committed by Baoshuo Ren
parent 0580173eee
commit 26e03541dd
Signed by: baoshuo
GPG Key ID: 70F90A673FB1AB68

26
CodeForces/1589/C/C.cpp Normal file
View File

@ -0,0 +1,26 @@
#include <bits/stdc++.h>
using namespace std;
int t, n, a[105], b[105];
int main() {
cin >> t;
while (t--) {
bool flag = true;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> a[i];
}
for (int i = 0; i < n; i++) {
cin >> b[i];
}
sort(a, a + n);
sort(b, b + n);
for (int i = 0; i < n; i++) {
if (b[i] - a[i] > 1 || b[i] - a[i] < 0) flag = false;
}
cout << (flag ? "YES" : "NO") << endl;
}
return 0;
}