이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define all(x) x.begin(), x.end()
#define sz(x) int(x.size())
#define el '\n'
#define pb push_back
#define mp make_pair
#define ft first
#define sd second
using namespace std;
typedef long long ll;
const int N = (1 << 21);
ll n, a[N], ans;
bool mk[N];
int main() {
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
cin >> n;
n = 1 << n;
for (int i = 0; i < n; ++i)
cin >> a[i];
int fx = n - 1;
for (int i = 0; i < n; ++i) {
int cur = 0, cnt = 0;
for (int j = i; j < n; ++j) {
cur ^= a[j];
mk[a[j]] = 1;
if (mk[fx ^ a[j]]) cnt--;
else cnt++;
if (cur == fx) {
if (j - i + 3 <= n || j - i + 1 > 1)
ans++;
} else ans += (cnt > 0);
}
for (int j = 0; j < n; ++j)
mk[j] = 0;
}
cout << ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |