/*
بسم الله الرحمن الرحيم
Author:
(:Muhammad Aneeq:)
*/
#include <iostream>
#include <algorithm>
using namespace std;
inline void solve()
{
int n,l;
cin>>n>>l;
int a[n];
for (auto &i:a)
cin>>i;
int q;
cin>>q;
int qu[q];
for (auto& i:qu)
cin>>i;
int ans[q][n-l+1]={};
for (int i=0;i<=n-l;i++)
{
for (int j=i+1;j<=n-l;j++)
{
int z=0;
for (int f=0;f<l;f++)
{
if (a[i+f]!=a[j+f])
z++;
}
for (int f=0;f<q;f++)
if (qu[f]>=z)
{
ans[f][i]++;
ans[f][j]++;
}
}
}
for (int i=0;i<q;i++)
for (int j=0;j<=n-l;j++)
cout<<ans[i][j]<<(j==n-l?'\n':' ');
}
int main()
{
ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
solve();
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
344 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
344 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
348 KB |
Output is correct |
8 |
Correct |
2 ms |
344 KB |
Output is correct |
9 |
Correct |
1 ms |
344 KB |
Output is correct |
10 |
Correct |
2 ms |
344 KB |
Output is correct |
11 |
Correct |
2 ms |
344 KB |
Output is correct |
12 |
Correct |
2 ms |
344 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
344 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
344 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
348 KB |
Output is correct |
8 |
Correct |
2 ms |
344 KB |
Output is correct |
9 |
Correct |
1 ms |
344 KB |
Output is correct |
10 |
Correct |
2 ms |
344 KB |
Output is correct |
11 |
Correct |
2 ms |
344 KB |
Output is correct |
12 |
Correct |
2 ms |
344 KB |
Output is correct |
13 |
Correct |
22 ms |
492 KB |
Output is correct |
14 |
Correct |
212 ms |
560 KB |
Output is correct |
15 |
Correct |
206 ms |
492 KB |
Output is correct |
16 |
Correct |
154 ms |
596 KB |
Output is correct |
17 |
Correct |
175 ms |
568 KB |
Output is correct |
18 |
Correct |
179 ms |
592 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
335 ms |
504 KB |
Output is correct |
2 |
Correct |
631 ms |
344 KB |
Output is correct |
3 |
Correct |
219 ms |
504 KB |
Output is correct |
4 |
Execution timed out |
3034 ms |
344 KB |
Time limit exceeded |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
335 ms |
504 KB |
Output is correct |
2 |
Correct |
631 ms |
344 KB |
Output is correct |
3 |
Correct |
219 ms |
504 KB |
Output is correct |
4 |
Execution timed out |
3034 ms |
344 KB |
Time limit exceeded |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
344 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
344 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
348 KB |
Output is correct |
8 |
Correct |
2 ms |
344 KB |
Output is correct |
9 |
Correct |
1 ms |
344 KB |
Output is correct |
10 |
Correct |
2 ms |
344 KB |
Output is correct |
11 |
Correct |
2 ms |
344 KB |
Output is correct |
12 |
Correct |
2 ms |
344 KB |
Output is correct |
13 |
Correct |
22 ms |
492 KB |
Output is correct |
14 |
Correct |
212 ms |
560 KB |
Output is correct |
15 |
Correct |
206 ms |
492 KB |
Output is correct |
16 |
Correct |
154 ms |
596 KB |
Output is correct |
17 |
Correct |
175 ms |
568 KB |
Output is correct |
18 |
Correct |
179 ms |
592 KB |
Output is correct |
19 |
Correct |
335 ms |
504 KB |
Output is correct |
20 |
Correct |
631 ms |
344 KB |
Output is correct |
21 |
Correct |
219 ms |
504 KB |
Output is correct |
22 |
Execution timed out |
3034 ms |
344 KB |
Time limit exceeded |
23 |
Halted |
0 ms |
0 KB |
- |