69182023-12-19 18:31:45111Növekvő XORcpp17Accepted 100/10093ms4520 KiB
#define _GLIBCXX_DEBUG

#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> b(30);
	vector<int> c(30);
	for (int i = 0; i < N; i++) {
		int x;
		cin >> x;
		int h = __lg(x);
		b[h]++;
		x -= 1 << h;
		while (x) {
			h = __lg(x);
			c[h]++;
			x -= 1 << h;
		}
		bool ok = true;
		for (int j = 0; j < 30; j++) {
			ok &= b[j] - c[j] <= 1;
		}
		cout << (ok ? "YES" : "NO") << '\n';
	}
	return 0;
}
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Accepted3ms1836 KiB
2Accepted3ms2024 KiB
subtask210/10
3Accepted3ms2240 KiB
4Accepted3ms2464 KiB
5Accepted3ms2564 KiB
6Accepted3ms2660 KiB
7Accepted3ms2776 KiB
8Accepted3ms2988 KiB
9Accepted3ms3180 KiB
10Accepted3ms3272 KiB
subtask311/11
11Accepted3ms3268 KiB
12Accepted3ms3268 KiB
13Accepted85ms3616 KiB
14Accepted85ms3632 KiB
15Accepted85ms3524 KiB
subtask435/35
16Accepted3ms3480 KiB
17Accepted3ms3572 KiB
18Accepted3ms3704 KiB
19Accepted3ms3784 KiB
20Accepted3ms3824 KiB
21Accepted3ms3936 KiB
22Accepted3ms3936 KiB
23Accepted3ms4160 KiB
subtask544/44
24Accepted86ms4204 KiB
25Accepted90ms4192 KiB
26Accepted90ms4396 KiB
27Accepted90ms4428 KiB
28Accepted93ms4376 KiB
29Accepted93ms4384 KiB
30Accepted93ms4376 KiB
31Accepted93ms4508 KiB
32Accepted93ms4520 KiB
33Accepted93ms4388 KiB