#include <bits/stdc++.h>
using namespace std;
const int k_N = 1e4 + 3;
int n, l;
int a[k_N];
int cnt[k_N][k_N];
int main(){
ios::sync_with_stdio(false);
cin.tie(NULL);
cin >> n >> l;
for(int i = 0; i < n; ++i)
cin >> a[i];
for(int i = 0; i < n - l + 1; ++i){
for(int j = i + 1; j < n - l + 1; ++j){
int diff = 0;
for(int k = 0; k < l; ++k)
if(a[i + k] != a[j + k])
diff++;
cnt[i][diff]++;
cnt[j][diff]++;
}
}
for(int i = 0; i < n; ++i)
for(int j = 1; j < n; ++j)
cnt[i][j] += cnt[i][j - 1];
int q;
cin >> q;
for(int i = 0; i < q; ++i){
int k;
cin >> k;
for(int j = 0; j < n - l + 1; ++j)
cout << cnt[j][k] << " ";
cout << "\n";
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
5 ms |
768 KB |
Output is correct |
3 |
Correct |
5 ms |
768 KB |
Output is correct |
4 |
Correct |
5 ms |
768 KB |
Output is correct |
5 |
Correct |
5 ms |
768 KB |
Output is correct |
6 |
Correct |
5 ms |
768 KB |
Output is correct |
7 |
Correct |
5 ms |
768 KB |
Output is correct |
8 |
Correct |
7 ms |
1920 KB |
Output is correct |
9 |
Correct |
7 ms |
1920 KB |
Output is correct |
10 |
Correct |
7 ms |
1920 KB |
Output is correct |
11 |
Correct |
7 ms |
1920 KB |
Output is correct |
12 |
Correct |
7 ms |
1920 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
5 ms |
768 KB |
Output is correct |
3 |
Correct |
5 ms |
768 KB |
Output is correct |
4 |
Correct |
5 ms |
768 KB |
Output is correct |
5 |
Correct |
5 ms |
768 KB |
Output is correct |
6 |
Correct |
5 ms |
768 KB |
Output is correct |
7 |
Correct |
5 ms |
768 KB |
Output is correct |
8 |
Correct |
7 ms |
1920 KB |
Output is correct |
9 |
Correct |
7 ms |
1920 KB |
Output is correct |
10 |
Correct |
7 ms |
1920 KB |
Output is correct |
11 |
Correct |
7 ms |
1920 KB |
Output is correct |
12 |
Correct |
7 ms |
1920 KB |
Output is correct |
13 |
Correct |
49 ms |
24184 KB |
Output is correct |
14 |
Correct |
298 ms |
24184 KB |
Output is correct |
15 |
Correct |
317 ms |
24048 KB |
Output is correct |
16 |
Correct |
250 ms |
24184 KB |
Output is correct |
17 |
Correct |
282 ms |
24300 KB |
Output is correct |
18 |
Correct |
340 ms |
24184 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
755 ms |
65536 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
755 ms |
65536 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
5 ms |
768 KB |
Output is correct |
3 |
Correct |
5 ms |
768 KB |
Output is correct |
4 |
Correct |
5 ms |
768 KB |
Output is correct |
5 |
Correct |
5 ms |
768 KB |
Output is correct |
6 |
Correct |
5 ms |
768 KB |
Output is correct |
7 |
Correct |
5 ms |
768 KB |
Output is correct |
8 |
Correct |
7 ms |
1920 KB |
Output is correct |
9 |
Correct |
7 ms |
1920 KB |
Output is correct |
10 |
Correct |
7 ms |
1920 KB |
Output is correct |
11 |
Correct |
7 ms |
1920 KB |
Output is correct |
12 |
Correct |
7 ms |
1920 KB |
Output is correct |
13 |
Correct |
49 ms |
24184 KB |
Output is correct |
14 |
Correct |
298 ms |
24184 KB |
Output is correct |
15 |
Correct |
317 ms |
24048 KB |
Output is correct |
16 |
Correct |
250 ms |
24184 KB |
Output is correct |
17 |
Correct |
282 ms |
24300 KB |
Output is correct |
18 |
Correct |
340 ms |
24184 KB |
Output is correct |
19 |
Runtime error |
755 ms |
65536 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
20 |
Halted |
0 ms |
0 KB |
- |