6918 | 2023-12-19 18:31:45 | 111 | Növekvő XOR | cpp17 | Accepted 100/100 | 93ms | 4520 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;
}
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Accepted | 3ms | 1836 KiB | ||||
2 | Accepted | 3ms | 2024 KiB | ||||
subtask2 | 10/10 | ||||||
3 | Accepted | 3ms | 2240 KiB | ||||
4 | Accepted | 3ms | 2464 KiB | ||||
5 | Accepted | 3ms | 2564 KiB | ||||
6 | Accepted | 3ms | 2660 KiB | ||||
7 | Accepted | 3ms | 2776 KiB | ||||
8 | Accepted | 3ms | 2988 KiB | ||||
9 | Accepted | 3ms | 3180 KiB | ||||
10 | Accepted | 3ms | 3272 KiB | ||||
subtask3 | 11/11 | ||||||
11 | Accepted | 3ms | 3268 KiB | ||||
12 | Accepted | 3ms | 3268 KiB | ||||
13 | Accepted | 85ms | 3616 KiB | ||||
14 | Accepted | 85ms | 3632 KiB | ||||
15 | Accepted | 85ms | 3524 KiB | ||||
subtask4 | 35/35 | ||||||
16 | Accepted | 3ms | 3480 KiB | ||||
17 | Accepted | 3ms | 3572 KiB | ||||
18 | Accepted | 3ms | 3704 KiB | ||||
19 | Accepted | 3ms | 3784 KiB | ||||
20 | Accepted | 3ms | 3824 KiB | ||||
21 | Accepted | 3ms | 3936 KiB | ||||
22 | Accepted | 3ms | 3936 KiB | ||||
23 | Accepted | 3ms | 4160 KiB | ||||
subtask5 | 44/44 | ||||||
24 | Accepted | 86ms | 4204 KiB | ||||
25 | Accepted | 90ms | 4192 KiB | ||||
26 | Accepted | 90ms | 4396 KiB | ||||
27 | Accepted | 90ms | 4428 KiB | ||||
28 | Accepted | 93ms | 4376 KiB | ||||
29 | Accepted | 93ms | 4384 KiB | ||||
30 | Accepted | 93ms | 4376 KiB | ||||
31 | Accepted | 93ms | 4508 KiB | ||||
32 | Accepted | 93ms | 4520 KiB | ||||
33 | Accepted | 93ms | 4388 KiB |