#include<bits/stdc++.h>
using namespace std;
#define int short
const short MAX_N=10000+5;
long long arr[MAX_N];
short much[MAX_N][MAX_N];
signed main(){
int n,l; cin>>n>>l;
for(int i=1;i<=n;i++) cin>>arr[i];
for(int i=1;i<=n-l+1;i++){
for(int j=i+1;j<=n-l+1;j++){
int cnt=0;
for(int k=0;k<l;k++){
if(arr[i+k]!=arr[j+k]) cnt++;
}
much[i][cnt]++;
much[j][cnt]++;
}
}
for(int i=1;i<=n-l+1;i++){
for(int j=0;j<=l;j++){
// cout<<much[i][j]<<" ";
much[i][j]+=much[i][j-1];
}
// cout<<endl;
}
int q; cin>>q;
while(q--){
int x; cin>>x;
for(int i=1;i<=n-l+1;i++) cout<<much[i][x]<<" ";
cout<<endl;
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
604 KB |
Output is correct |
3 |
Correct |
1 ms |
604 KB |
Output is correct |
4 |
Correct |
0 ms |
604 KB |
Output is correct |
5 |
Correct |
0 ms |
604 KB |
Output is correct |
6 |
Correct |
1 ms |
604 KB |
Output is correct |
7 |
Correct |
0 ms |
604 KB |
Output is correct |
8 |
Correct |
3 ms |
1116 KB |
Output is correct |
9 |
Correct |
1 ms |
1112 KB |
Output is correct |
10 |
Correct |
1 ms |
1372 KB |
Output is correct |
11 |
Correct |
2 ms |
1372 KB |
Output is correct |
12 |
Correct |
2 ms |
1372 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
604 KB |
Output is correct |
3 |
Correct |
1 ms |
604 KB |
Output is correct |
4 |
Correct |
0 ms |
604 KB |
Output is correct |
5 |
Correct |
0 ms |
604 KB |
Output is correct |
6 |
Correct |
1 ms |
604 KB |
Output is correct |
7 |
Correct |
0 ms |
604 KB |
Output is correct |
8 |
Correct |
3 ms |
1116 KB |
Output is correct |
9 |
Correct |
1 ms |
1112 KB |
Output is correct |
10 |
Correct |
1 ms |
1372 KB |
Output is correct |
11 |
Correct |
2 ms |
1372 KB |
Output is correct |
12 |
Correct |
2 ms |
1372 KB |
Output is correct |
13 |
Correct |
13 ms |
18264 KB |
Output is correct |
14 |
Correct |
182 ms |
19536 KB |
Output is correct |
15 |
Correct |
187 ms |
16448 KB |
Output is correct |
16 |
Correct |
153 ms |
19476 KB |
Output is correct |
17 |
Correct |
172 ms |
17652 KB |
Output is correct |
18 |
Correct |
166 ms |
17492 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
323 ms |
40824 KB |
Memory limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
323 ms |
40824 KB |
Memory limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
604 KB |
Output is correct |
3 |
Correct |
1 ms |
604 KB |
Output is correct |
4 |
Correct |
0 ms |
604 KB |
Output is correct |
5 |
Correct |
0 ms |
604 KB |
Output is correct |
6 |
Correct |
1 ms |
604 KB |
Output is correct |
7 |
Correct |
0 ms |
604 KB |
Output is correct |
8 |
Correct |
3 ms |
1116 KB |
Output is correct |
9 |
Correct |
1 ms |
1112 KB |
Output is correct |
10 |
Correct |
1 ms |
1372 KB |
Output is correct |
11 |
Correct |
2 ms |
1372 KB |
Output is correct |
12 |
Correct |
2 ms |
1372 KB |
Output is correct |
13 |
Correct |
13 ms |
18264 KB |
Output is correct |
14 |
Correct |
182 ms |
19536 KB |
Output is correct |
15 |
Correct |
187 ms |
16448 KB |
Output is correct |
16 |
Correct |
153 ms |
19476 KB |
Output is correct |
17 |
Correct |
172 ms |
17652 KB |
Output is correct |
18 |
Correct |
166 ms |
17492 KB |
Output is correct |
19 |
Runtime error |
323 ms |
40824 KB |
Memory limit exceeded |
20 |
Halted |
0 ms |
0 KB |
- |