#include <bits/stdc++.h>
using namespace std;
int main()
{
int l, n;
cin >> n >> l;
vector<int> a(n);
for(auto &i:a) cin >> i;
int q;
cin >> q;
while(q--)
{
int k;
cin >> k;
for(int i = 0; i < n-l+1; i++)
{
int ans = 0;
for(int j = 0; j < n-l+1; j++)
{
if (i==j) continue;
int diff = 0;
for(int llll = 0; llll < l; llll++)
{
diff+=a[i+llll]!=a[j+llll];
}
if(diff<=k) ans++;
}
cout << ans << ' ';
}
cout << '\n';
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
2 ms |
348 KB |
Output is correct |
3 |
Correct |
2 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
1 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
348 KB |
Output is correct |
8 |
Correct |
48 ms |
436 KB |
Output is correct |
9 |
Correct |
48 ms |
348 KB |
Output is correct |
10 |
Correct |
20 ms |
348 KB |
Output is correct |
11 |
Correct |
20 ms |
348 KB |
Output is correct |
12 |
Correct |
31 ms |
344 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
2 ms |
348 KB |
Output is correct |
3 |
Correct |
2 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
1 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
348 KB |
Output is correct |
8 |
Correct |
48 ms |
436 KB |
Output is correct |
9 |
Correct |
48 ms |
348 KB |
Output is correct |
10 |
Correct |
20 ms |
348 KB |
Output is correct |
11 |
Correct |
20 ms |
348 KB |
Output is correct |
12 |
Correct |
31 ms |
344 KB |
Output is correct |
13 |
Correct |
55 ms |
344 KB |
Output is correct |
14 |
Execution timed out |
3028 ms |
416 KB |
Time limit exceeded |
15 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
218 ms |
348 KB |
Output is correct |
2 |
Correct |
393 ms |
472 KB |
Output is correct |
3 |
Correct |
224 ms |
348 KB |
Output is correct |
4 |
Execution timed out |
3066 ms |
348 KB |
Time limit exceeded |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
218 ms |
348 KB |
Output is correct |
2 |
Correct |
393 ms |
472 KB |
Output is correct |
3 |
Correct |
224 ms |
348 KB |
Output is correct |
4 |
Execution timed out |
3066 ms |
348 KB |
Time limit exceeded |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
2 ms |
348 KB |
Output is correct |
3 |
Correct |
2 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
1 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
348 KB |
Output is correct |
8 |
Correct |
48 ms |
436 KB |
Output is correct |
9 |
Correct |
48 ms |
348 KB |
Output is correct |
10 |
Correct |
20 ms |
348 KB |
Output is correct |
11 |
Correct |
20 ms |
348 KB |
Output is correct |
12 |
Correct |
31 ms |
344 KB |
Output is correct |
13 |
Correct |
55 ms |
344 KB |
Output is correct |
14 |
Execution timed out |
3028 ms |
416 KB |
Time limit exceeded |
15 |
Halted |
0 ms |
0 KB |
- |