#include <bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
#define pii pair<int, int>
signed main() {
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
#ifdef CB
freopen("in.txt", "r", stdin);
// freopen("out.txt", "w", stdout);
#endif
int N;
cin >> N;
vector<int> X(N), Y(N), Z(N);
for (int i = 0; i < N; i++) {
cin >> X[i];
}
for (int i = 0; i < N; i++) {
cin >> Y[i];
}
for (int i = 0; i < N; i++) {
cin >> Z[i];
}
set<tuple<int, int, int>> s;
for (int i = 0; i < N; i++) {
s.insert({X[i], Y[i], Z[i]});
}
for (int i = 0; i < N; i++) {
for (int j = i + 1; j < N; j++) {
bool ok = true;
if (X[i] < X[j]) {
if (s.count({X[i] + 1, Y[i], Z[i]})) {
continue;
}
ok = false;
}
if (Y[i] < Y[j]) {
if (s.count({X[i], Y[i] + 1, Z[i]})) {
continue;
}
ok = false;
}
if (Z[i] < Z[j]) {
if (s.count({X[i], Y[i], Z[i] + 1})) {
continue;
}
ok = false;
}
if (!ok) {
goto bad;
}
}
}
cout << "YES" << '\n';
return 0;
bad:
cout << "NO" << '\n';
return 0;
}
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Accepted | 3ms | 1824 KiB | ||||
2 | Accepted | 3ms | 2056 KiB | ||||
3 | Accepted | 3ms | 2276 KiB | ||||
subtask2 | 0/18 | ||||||
4 | Accepted | 3ms | 2336 KiB | ||||
5 | Accepted | 3ms | 2548 KiB | ||||
6 | Wrong answer | 3ms | 2920 KiB | ||||
7 | Wrong answer | 3ms | 3300 KiB | ||||
8 | Wrong answer | 3ms | 3172 KiB | ||||
9 | Accepted | 3ms | 3368 KiB | ||||
10 | Wrong answer | 3ms | 3564 KiB | ||||
11 | Wrong answer | 3ms | 3624 KiB | ||||
12 | Accepted | 3ms | 3704 KiB | ||||
13 | Accepted | 3ms | 3836 KiB | ||||
subtask3 | 0/19 | ||||||
14 | Accepted | 7ms | 5196 KiB | ||||
15 | Wrong answer | 3ms | 3924 KiB | ||||
16 | Accepted | 6ms | 4908 KiB | ||||
17 | Accepted | 9ms | 5464 KiB | ||||
18 | Wrong answer | 12ms | 5576 KiB | ||||
19 | Wrong answer | 8ms | 5344 KiB | ||||
20 | Accepted | 3ms | 4040 KiB | ||||
21 | Accepted | 4ms | 4704 KiB | ||||
22 | Accepted | 7ms | 5308 KiB | ||||
23 | Accepted | 8ms | 5544 KiB | ||||
24 | Accepted | 8ms | 5720 KiB | ||||
25 | Accepted | 25ms | 5848 KiB | ||||
26 | Accepted | 3ms | 4628 KiB | ||||
subtask4 | 0/24 | ||||||
27 | Accepted | 76ms | 21836 KiB | ||||
28 | Accepted | 54ms | 5232 KiB | ||||
29 | Wrong answer | 722ms | 21880 KiB | ||||
30 | Wrong answer | 2.903s | 21900 KiB | ||||
31 | Wrong answer | 1.207s | 21948 KiB | ||||
32 | Wrong answer | 261ms | 22088 KiB | ||||
33 | Accepted | 3ms | 5320 KiB | ||||
34 | Time limit exceeded | 3.099s | 12852 KiB | ||||
35 | Wrong answer | 1.705s | 21964 KiB | ||||
36 | Accepted | 1.595s | 21968 KiB | ||||
37 | Wrong answer | 524ms | 22184 KiB | ||||
38 | Accepted | 210ms | 22056 KiB | ||||
39 | Accepted | 3ms | 5116 KiB | ||||
subtask5 | 0/22 | ||||||
40 | Accepted | 81ms | 21960 KiB | ||||
41 | Wrong answer | 3ms | 4956 KiB | ||||
42 | Accepted | 46ms | 9912 KiB | ||||
43 | Accepted | 349ms | 21720 KiB | ||||
44 | Wrong answer | 109ms | 21704 KiB | ||||
45 | Wrong answer | 256ms | 22136 KiB | ||||
46 | Accepted | 3ms | 4960 KiB | ||||
47 | Accepted | 3ms | 4956 KiB | ||||
48 | Accepted | 34ms | 8328 KiB | ||||
49 | Accepted | 90ms | 20276 KiB | ||||
50 | Accepted | 317ms | 21900 KiB | ||||
51 | Accepted | 160ms | 21860 KiB | ||||
52 | Accepted | 97ms | 22312 KiB | ||||
53 | Accepted | 3ms | 5308 KiB | ||||
subtask6 | 0/17 | ||||||
54 | Accepted | 79ms | 22360 KiB | ||||
55 | Wrong answer | 85ms | 22400 KiB | ||||
56 | Accepted | 120ms | 22296 KiB | ||||
57 | Accepted | 228ms | 22352 KiB | ||||
58 | Accepted | 381ms | 22376 KiB | ||||
59 | Wrong answer | 123ms | 22300 KiB | ||||
60 | Time limit exceeded | 3.075s | 13076 KiB | ||||
61 | Accepted | 111ms | 22296 KiB | ||||
62 | Accepted | 144ms | 22444 KiB | ||||
63 | Accepted | 317ms | 22084 KiB | ||||
64 | Wrong answer | 282ms | 22080 KiB | ||||
65 | Accepted | 204ms | 22516 KiB | ||||
66 | Accepted | 72ms | 22472 KiB |