This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
int main () {
int n, k, ans = 0;
cin >> n >> k;
deque <int> v, v2;
for (int i = 0; i + k <= n; i++) {
int x;
cin >> x;
v.push_back(x);
}
for (int i = 0; i < (1 << n); i++) {
int sum = 0;
for (int j = 0; j < k; j++) sum += ((1 << j) & i) > 0;
v2.clear();
for (int j = 0; j + k <= n; j++) {
v2.push_back(sum);
if (j + k == n) break;
sum += ((1 << (j + k)) & i) > 0;
sum -= ((1 << j) & i) > 0;
}
if (v2 == v) ans++;
}
cout << ans << '\n';
}
# | 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... |