#include <bits/stdc++.h>
#define int int64_t
using namespace std;
const int maxn = 1e4 + 10;
int v[maxn], n, l;
int dist[maxn][maxn];
int ct[maxn], ct2[maxn];
int32_t main() {
ios::sync_with_stdio(false), cin.tie(0);
cin >> n >> l;
for(int i=1;i<=n;i++)
cin >> v[i];
for(int i=1;i<=n-l+1;i++){
for(int j=1;j<=n-l+1;j++){
for(int k=0;k<l;k++)
dist[i][j] += (v[i+k] != v[j+k]);
}
}
// .for(int i=1;i<=n-l+1;i++)
// for(int j=i+1;j<=n-l+1;j++)
// cout << i << " " << j << ": " << dist[i][j] << "\n";
int q;
cin >> q;
while(q--){
int x;
cin >> x;
for(int i=1;i<=n-l+1;i++){
int resp=0;
for(int j=1;j<=n-l+1;j++){
if(i==j) continue;
resp += (dist[i][j]<=x);
}
cout << resp << " \n"[i==n-l+1];
}
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
384 KB |
Output is correct |
2 |
Correct |
3 ms |
640 KB |
Output is correct |
3 |
Correct |
4 ms |
768 KB |
Output is correct |
4 |
Correct |
2 ms |
512 KB |
Output is correct |
5 |
Correct |
3 ms |
512 KB |
Output is correct |
6 |
Correct |
3 ms |
896 KB |
Output is correct |
7 |
Correct |
3 ms |
768 KB |
Output is correct |
8 |
Correct |
7 ms |
1152 KB |
Output is correct |
9 |
Correct |
7 ms |
1152 KB |
Output is correct |
10 |
Correct |
10 ms |
2176 KB |
Output is correct |
11 |
Correct |
7 ms |
2176 KB |
Output is correct |
12 |
Correct |
8 ms |
2048 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
384 KB |
Output is correct |
2 |
Correct |
3 ms |
640 KB |
Output is correct |
3 |
Correct |
4 ms |
768 KB |
Output is correct |
4 |
Correct |
2 ms |
512 KB |
Output is correct |
5 |
Correct |
3 ms |
512 KB |
Output is correct |
6 |
Correct |
3 ms |
896 KB |
Output is correct |
7 |
Correct |
3 ms |
768 KB |
Output is correct |
8 |
Correct |
7 ms |
1152 KB |
Output is correct |
9 |
Correct |
7 ms |
1152 KB |
Output is correct |
10 |
Correct |
10 ms |
2176 KB |
Output is correct |
11 |
Correct |
7 ms |
2176 KB |
Output is correct |
12 |
Correct |
8 ms |
2048 KB |
Output is correct |
13 |
Runtime error |
59 ms |
33792 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
14 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
62 ms |
33792 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
62 ms |
33792 KB |
Execution killed with signal 9 (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 |
3 ms |
640 KB |
Output is correct |
3 |
Correct |
4 ms |
768 KB |
Output is correct |
4 |
Correct |
2 ms |
512 KB |
Output is correct |
5 |
Correct |
3 ms |
512 KB |
Output is correct |
6 |
Correct |
3 ms |
896 KB |
Output is correct |
7 |
Correct |
3 ms |
768 KB |
Output is correct |
8 |
Correct |
7 ms |
1152 KB |
Output is correct |
9 |
Correct |
7 ms |
1152 KB |
Output is correct |
10 |
Correct |
10 ms |
2176 KB |
Output is correct |
11 |
Correct |
7 ms |
2176 KB |
Output is correct |
12 |
Correct |
8 ms |
2048 KB |
Output is correct |
13 |
Runtime error |
59 ms |
33792 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
14 |
Halted |
0 ms |
0 KB |
- |