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 maxn = 1e3 + 10;
int vet[maxn];
int main(){
int n, l;
cin >> n >> l;
for(int i=1; i<=n; i++){
cin >> vet[i];
}
int q;
cin >> q;
for(int i=1; i<=q; i++){
int k;
cin >> k;
for(int ini=1; ini<=n-l+1; ini++){
int ans=0;
for(int fim=1; fim<=n-l+1; fim++){
if(fim==ini)fim++;
if(fim>n-l+1)break;
int sum=0;
for(int w=0; w<l; w++){
if(vet[ini+w]!=vet[fim+w])sum++;
}
if(sum<=k)ans++;
}
cout << ans << " ";
}
cout << endl;
}
}
# | 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... |