/*raghav0307 - Raghav Gupta*/
#include <bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define pb push_back
#define fast_io() ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
typedef long long ll;
typedef pair<int, int> pii;
typedef long double ld;
#define int ll
int dp[305][305];
signed main(){
fast_io();
int n, l;
cin >> n >> l;
int a[n];
for(int i = 0; i < n; i++) cin >> a[i];
int q;
cin >> q;
for(int i = 0; i < n; i++){
for(int j = 0; j < i; j++){
if(a[i] == a[j]) continue;
int cnt = l;
int x = i;
int y = j;
while(x >= 0 and y >= 0 and cnt > 0){
dp[x][y]++;
dp[y][x]++;
x--;
y--;
cnt--;
}
}
}
while(q--){
int k; cin >> k;
for(int i = 0; i < n-l+1; i++){
int cnt = 0;
for(int j = 0; j < n-l+1; j++){
if(i == j) continue;
if(dp[i][j] <= k) cnt++;
}
cout << cnt << " ";
}
cout << "\n";
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
384 KB |
Output is correct |
2 |
Correct |
3 ms |
640 KB |
Output is correct |
3 |
Correct |
2 ms |
512 KB |
Output is correct |
4 |
Correct |
2 ms |
512 KB |
Output is correct |
5 |
Correct |
2 ms |
512 KB |
Output is correct |
6 |
Correct |
3 ms |
520 KB |
Output is correct |
7 |
Correct |
2 ms |
512 KB |
Output is correct |
8 |
Correct |
15 ms |
1024 KB |
Output is correct |
9 |
Correct |
13 ms |
1024 KB |
Output is correct |
10 |
Correct |
6 ms |
1024 KB |
Output is correct |
11 |
Correct |
6 ms |
1024 KB |
Output is correct |
12 |
Correct |
7 ms |
1024 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 |
2 ms |
512 KB |
Output is correct |
4 |
Correct |
2 ms |
512 KB |
Output is correct |
5 |
Correct |
2 ms |
512 KB |
Output is correct |
6 |
Correct |
3 ms |
520 KB |
Output is correct |
7 |
Correct |
2 ms |
512 KB |
Output is correct |
8 |
Correct |
15 ms |
1024 KB |
Output is correct |
9 |
Correct |
13 ms |
1024 KB |
Output is correct |
10 |
Correct |
6 ms |
1024 KB |
Output is correct |
11 |
Correct |
6 ms |
1024 KB |
Output is correct |
12 |
Correct |
7 ms |
1024 KB |
Output is correct |
13 |
Runtime error |
4 ms |
1920 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
14 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
5 ms |
2176 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
5 ms |
2176 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 |
3 ms |
640 KB |
Output is correct |
3 |
Correct |
2 ms |
512 KB |
Output is correct |
4 |
Correct |
2 ms |
512 KB |
Output is correct |
5 |
Correct |
2 ms |
512 KB |
Output is correct |
6 |
Correct |
3 ms |
520 KB |
Output is correct |
7 |
Correct |
2 ms |
512 KB |
Output is correct |
8 |
Correct |
15 ms |
1024 KB |
Output is correct |
9 |
Correct |
13 ms |
1024 KB |
Output is correct |
10 |
Correct |
6 ms |
1024 KB |
Output is correct |
11 |
Correct |
6 ms |
1024 KB |
Output is correct |
12 |
Correct |
7 ms |
1024 KB |
Output is correct |
13 |
Runtime error |
4 ms |
1920 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
14 |
Halted |
0 ms |
0 KB |
- |