#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 2000;
int v[MAX_N], diff[MAX_N][MAX_N], good[MAX_N][MAX_N + 1];
int main() {
int n, k;
cin >> n >> k;
for ( int i = 0; i < n; i++ )
cin >> v[i];
for ( int i = 0; i < n; i++ ) {
for ( int j = i + 1; j < n; j++ ) {
if ( v[i] == v[j] )
continue;
int l = min( k, i + 1 );
for ( int o = 0; o < l; o++ )
diff[i - o][j - o]++;
}
}
for ( int i = 0; i < n; i++ ) {
for ( int j = i + 1; j < n; j++ ) {
good[i][diff[i][j]]++;
good[j][diff[i][j]]++;
}
}
for ( int i = 0; i < n; i++ ) {
for ( int j = 1; j <= n; j++ )
good[i][j] += good[i][j - 1];
}
int q;
cin >> q;
while ( q-- ) {
int m;
cin >> m;
for ( int i = 0; i <= n - k; i++ )
cout << good[i][m] - 1 << " ";
cout << "\n";
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
448 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
448 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
2 ms |
604 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
2 ms |
604 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
448 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |