#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;
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
384 KB |
Output is correct |
2 |
Correct |
8 ms |
384 KB |
Output is correct |
3 |
Correct |
4 ms |
256 KB |
Output is correct |
4 |
Correct |
4 ms |
384 KB |
Output is correct |
5 |
Correct |
3 ms |
384 KB |
Output is correct |
6 |
Correct |
3 ms |
384 KB |
Output is correct |
7 |
Correct |
5 ms |
256 KB |
Output is correct |
8 |
Correct |
88 ms |
376 KB |
Output is correct |
9 |
Correct |
45 ms |
256 KB |
Output is correct |
10 |
Correct |
33 ms |
384 KB |
Output is correct |
11 |
Correct |
21 ms |
384 KB |
Output is correct |
12 |
Correct |
40 ms |
384 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
384 KB |
Output is correct |
2 |
Correct |
8 ms |
384 KB |
Output is correct |
3 |
Correct |
4 ms |
256 KB |
Output is correct |
4 |
Correct |
4 ms |
384 KB |
Output is correct |
5 |
Correct |
3 ms |
384 KB |
Output is correct |
6 |
Correct |
3 ms |
384 KB |
Output is correct |
7 |
Correct |
5 ms |
256 KB |
Output is correct |
8 |
Correct |
88 ms |
376 KB |
Output is correct |
9 |
Correct |
45 ms |
256 KB |
Output is correct |
10 |
Correct |
33 ms |
384 KB |
Output is correct |
11 |
Correct |
21 ms |
384 KB |
Output is correct |
12 |
Correct |
40 ms |
384 KB |
Output is correct |
13 |
Runtime error |
2 ms |
384 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
14 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
3 ms |
512 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
3 ms |
512 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
384 KB |
Output is correct |
2 |
Correct |
8 ms |
384 KB |
Output is correct |
3 |
Correct |
4 ms |
256 KB |
Output is correct |
4 |
Correct |
4 ms |
384 KB |
Output is correct |
5 |
Correct |
3 ms |
384 KB |
Output is correct |
6 |
Correct |
3 ms |
384 KB |
Output is correct |
7 |
Correct |
5 ms |
256 KB |
Output is correct |
8 |
Correct |
88 ms |
376 KB |
Output is correct |
9 |
Correct |
45 ms |
256 KB |
Output is correct |
10 |
Correct |
33 ms |
384 KB |
Output is correct |
11 |
Correct |
21 ms |
384 KB |
Output is correct |
12 |
Correct |
40 ms |
384 KB |
Output is correct |
13 |
Runtime error |
2 ms |
384 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
14 |
Halted |
0 ms |
0 KB |
- |