69212023-12-19 19:40:32111Pac-Mancpp17Time limit exceeded 37/1003.101s22376 KiB
#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++) {
			if (X[i] < X[j] && s.count({X[i] + 1, Y[i], Z[i]})) {
				continue;
			}
			if (X[i] > X[j] && s.count({X[i] - 1, Y[i], Z[i]})) {
				continue;
			}
			if (Y[i] < Y[j] && s.count({X[i], Y[i] + 1, Z[i]})) {
				continue;
			}
			if (Y[i] > Y[j] && s.count({X[i], Y[i] - 1, Z[i]})) {
				continue;
			}
			if (Z[i] < Z[j] && s.count({X[i], Y[i], Z[i] + 1})) {
				continue;
			}
			if (Z[i] > Z[j] && s.count({X[i], Y[i], Z[i] - 1})) {
				continue;
			}
			goto bad;
		}
	}
	cout << "YES" << '\n';
	return 0;
bad:
	cout << "NO" << '\n';
	return 0;
}
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Accepted3ms1824 KiB
2Accepted3ms2016 KiB
3Accepted3ms2248 KiB
subtask218/18
4Accepted3ms2488 KiB
5Accepted3ms2552 KiB
6Accepted3ms2756 KiB
7Accepted3ms2856 KiB
8Accepted3ms3072 KiB
9Accepted3ms3184 KiB
10Accepted3ms3412 KiB
11Accepted3ms3628 KiB
12Accepted3ms3712 KiB
13Accepted3ms3704 KiB
subtask319/19
14Accepted7ms5128 KiB
15Accepted3ms3832 KiB
16Accepted34ms4704 KiB
17Accepted14ms5264 KiB
18Accepted1.2s5220 KiB
19Accepted1.167s5212 KiB
20Accepted3ms4204 KiB
21Accepted41ms4752 KiB
22Accepted642ms5332 KiB
23Accepted28ms5404 KiB
24Accepted305ms5464 KiB
25Accepted41ms5480 KiB
26Accepted3ms4280 KiB
subtask40/24
27Accepted75ms21196 KiB
28Accepted96ms4864 KiB
29Time limit exceeded3.066s12348 KiB
30Time limit exceeded3.055s12032 KiB
31Time limit exceeded3.051s12180 KiB
32Time limit exceeded3.053s12176 KiB
33Accepted25ms4664 KiB
34Time limit exceeded3.101s12180 KiB
35Time limit exceeded3.101s12384 KiB
36Time limit exceeded3.019s12452 KiB
37Time limit exceeded3.039s12436 KiB
38Time limit exceeded3.055s12412 KiB
39Accepted14ms4656 KiB
subtask50/22
40Accepted78ms21636 KiB
41Accepted4ms4780 KiB
42Accepted558ms9672 KiB
43Accepted2.614s21924 KiB
44Time limit exceeded3.059s12672 KiB
45Time limit exceeded3.068s12864 KiB
46Accepted3ms4988 KiB
47Accepted3ms4972 KiB
48Accepted71ms8244 KiB
49Time limit exceeded3.059s11952 KiB
50Time limit exceeded3.055s12704 KiB
51Time limit exceeded3.052s12708 KiB
52Accepted1.253s22060 KiB
53Accepted3ms5004 KiB
subtask60/17
54Accepted83ms22052 KiB
55Time limit exceeded3.075s12824 KiB
56Accepted522ms22140 KiB
57Time limit exceeded3.058s13072 KiB
58Time limit exceeded3.073s12788 KiB
59Time limit exceeded3.073s12908 KiB
60Time limit exceeded3.055s12848 KiB
61Accepted551ms22064 KiB
62Accepted773ms22236 KiB
63Time limit exceeded3.052s12776 KiB
64Time limit exceeded3.066s12980 KiB
65Accepted546ms22376 KiB
66Time limit exceeded3.042s12980 KiB