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;
const int N = 10004;
int n, l, a[N], q, v[N];
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
cin >> n >> l;
for (int i = 0; i < n; i++) {
cin >> a[i];
}
cin >> q;
while (q--) {
int k;
cin >> k;
fill(v, v + n - l + 1, 0);
for (int i = 1; i + l <= n; i++) {
int c = 0;
for (int j = 0; j < l - 1; j++) {
c += (a[j] != a[j + i]);
}
for (int s = 0, ss = i; ss + l <= n; s++, ss++) {
c += (a[s + l - 1] != a[ss + l - 1]);
v[s] += (c <= k);
v[ss] += (c <= k);
c -= (a[s] != a[ss]);
}
}
for (int i = 0; i + l <= n; i++) {
if (i > 0) {
cout << " ";
}
cout << v[i];
}
cout << '\n';
}
return 0;
}
# | 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... |