# include <bits/stdc++.h>
using namespace std;
long long n,l,k,a[300005],cnt[300005],pr[300005],ans[300005],q;
int main()
{
cin>>n>>l;
for (int i=1; i<=n; i++)
{
cin>>a[i];
}
cin>>q;
while (q--)
{
cin>>k;
k=(l-k);
for (int d=1; d<=n-1; d++)
{
for (int j=1; j<=n-d; j++)
{
if(a[j]==a[j+d]) cnt[j]++;
}
for (int j=1; j<=n-d; j++)
{
pr[j]=pr[j-1]+cnt[j];
cnt[j]=0;
}
for (int j=l; j<=n-d; j++)
{
if (pr[j]-pr[j-l]>=k) ans[j-l+1]++, ans[j-l+1+d]++;
}
}
for (int i=1; i<=n-l+1; i++)
{
cout<<ans[i]<<" ";
}
for (int i=1; i<=n; i++)
{
ans[i]=0;
}
cout<<endl;
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
256 KB |
Output is correct |
2 |
Correct |
1 ms |
384 KB |
Output is correct |
3 |
Correct |
1 ms |
384 KB |
Output is correct |
4 |
Correct |
1 ms |
384 KB |
Output is correct |
5 |
Correct |
1 ms |
384 KB |
Output is correct |
6 |
Correct |
1 ms |
384 KB |
Output is correct |
7 |
Correct |
1 ms |
384 KB |
Output is correct |
8 |
Correct |
5 ms |
384 KB |
Output is correct |
9 |
Correct |
5 ms |
384 KB |
Output is correct |
10 |
Correct |
6 ms |
384 KB |
Output is correct |
11 |
Correct |
6 ms |
384 KB |
Output is correct |
12 |
Correct |
6 ms |
384 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
256 KB |
Output is correct |
2 |
Correct |
1 ms |
384 KB |
Output is correct |
3 |
Correct |
1 ms |
384 KB |
Output is correct |
4 |
Correct |
1 ms |
384 KB |
Output is correct |
5 |
Correct |
1 ms |
384 KB |
Output is correct |
6 |
Correct |
1 ms |
384 KB |
Output is correct |
7 |
Correct |
1 ms |
384 KB |
Output is correct |
8 |
Correct |
5 ms |
384 KB |
Output is correct |
9 |
Correct |
5 ms |
384 KB |
Output is correct |
10 |
Correct |
6 ms |
384 KB |
Output is correct |
11 |
Correct |
6 ms |
384 KB |
Output is correct |
12 |
Correct |
6 ms |
384 KB |
Output is correct |
13 |
Correct |
71 ms |
504 KB |
Output is correct |
14 |
Correct |
196 ms |
480 KB |
Output is correct |
15 |
Correct |
112 ms |
632 KB |
Output is correct |
16 |
Correct |
221 ms |
632 KB |
Output is correct |
17 |
Correct |
212 ms |
512 KB |
Output is correct |
18 |
Correct |
216 ms |
504 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
577 ms |
712 KB |
Output is correct |
2 |
Correct |
528 ms |
760 KB |
Output is correct |
3 |
Correct |
328 ms |
640 KB |
Output is correct |
4 |
Correct |
293 ms |
760 KB |
Output is correct |
5 |
Correct |
224 ms |
760 KB |
Output is correct |
6 |
Correct |
275 ms |
760 KB |
Output is correct |
7 |
Correct |
213 ms |
760 KB |
Output is correct |
8 |
Correct |
226 ms |
760 KB |
Output is correct |
9 |
Correct |
278 ms |
760 KB |
Output is correct |
10 |
Correct |
304 ms |
760 KB |
Output is correct |
11 |
Correct |
27 ms |
384 KB |
Output is correct |
12 |
Correct |
218 ms |
632 KB |
Output is correct |
13 |
Correct |
265 ms |
632 KB |
Output is correct |
14 |
Correct |
252 ms |
760 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
577 ms |
712 KB |
Output is correct |
2 |
Correct |
528 ms |
760 KB |
Output is correct |
3 |
Correct |
328 ms |
640 KB |
Output is correct |
4 |
Correct |
293 ms |
760 KB |
Output is correct |
5 |
Correct |
224 ms |
760 KB |
Output is correct |
6 |
Correct |
275 ms |
760 KB |
Output is correct |
7 |
Correct |
213 ms |
760 KB |
Output is correct |
8 |
Correct |
226 ms |
760 KB |
Output is correct |
9 |
Correct |
278 ms |
760 KB |
Output is correct |
10 |
Correct |
304 ms |
760 KB |
Output is correct |
11 |
Correct |
27 ms |
384 KB |
Output is correct |
12 |
Correct |
218 ms |
632 KB |
Output is correct |
13 |
Correct |
265 ms |
632 KB |
Output is correct |
14 |
Correct |
252 ms |
760 KB |
Output is correct |
15 |
Correct |
323 ms |
760 KB |
Output is correct |
16 |
Correct |
273 ms |
640 KB |
Output is correct |
17 |
Correct |
301 ms |
640 KB |
Output is correct |
18 |
Correct |
299 ms |
892 KB |
Output is correct |
19 |
Correct |
296 ms |
760 KB |
Output is correct |
20 |
Correct |
307 ms |
760 KB |
Output is correct |
21 |
Correct |
283 ms |
708 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
256 KB |
Output is correct |
2 |
Correct |
1 ms |
384 KB |
Output is correct |
3 |
Correct |
1 ms |
384 KB |
Output is correct |
4 |
Correct |
1 ms |
384 KB |
Output is correct |
5 |
Correct |
1 ms |
384 KB |
Output is correct |
6 |
Correct |
1 ms |
384 KB |
Output is correct |
7 |
Correct |
1 ms |
384 KB |
Output is correct |
8 |
Correct |
5 ms |
384 KB |
Output is correct |
9 |
Correct |
5 ms |
384 KB |
Output is correct |
10 |
Correct |
6 ms |
384 KB |
Output is correct |
11 |
Correct |
6 ms |
384 KB |
Output is correct |
12 |
Correct |
6 ms |
384 KB |
Output is correct |
13 |
Correct |
71 ms |
504 KB |
Output is correct |
14 |
Correct |
196 ms |
480 KB |
Output is correct |
15 |
Correct |
112 ms |
632 KB |
Output is correct |
16 |
Correct |
221 ms |
632 KB |
Output is correct |
17 |
Correct |
212 ms |
512 KB |
Output is correct |
18 |
Correct |
216 ms |
504 KB |
Output is correct |
19 |
Correct |
577 ms |
712 KB |
Output is correct |
20 |
Correct |
528 ms |
760 KB |
Output is correct |
21 |
Correct |
328 ms |
640 KB |
Output is correct |
22 |
Correct |
293 ms |
760 KB |
Output is correct |
23 |
Correct |
224 ms |
760 KB |
Output is correct |
24 |
Correct |
275 ms |
760 KB |
Output is correct |
25 |
Correct |
213 ms |
760 KB |
Output is correct |
26 |
Correct |
226 ms |
760 KB |
Output is correct |
27 |
Correct |
278 ms |
760 KB |
Output is correct |
28 |
Correct |
304 ms |
760 KB |
Output is correct |
29 |
Correct |
27 ms |
384 KB |
Output is correct |
30 |
Correct |
218 ms |
632 KB |
Output is correct |
31 |
Correct |
265 ms |
632 KB |
Output is correct |
32 |
Correct |
252 ms |
760 KB |
Output is correct |
33 |
Correct |
323 ms |
760 KB |
Output is correct |
34 |
Correct |
273 ms |
640 KB |
Output is correct |
35 |
Correct |
301 ms |
640 KB |
Output is correct |
36 |
Correct |
299 ms |
892 KB |
Output is correct |
37 |
Correct |
296 ms |
760 KB |
Output is correct |
38 |
Correct |
307 ms |
760 KB |
Output is correct |
39 |
Correct |
283 ms |
708 KB |
Output is correct |
40 |
Execution timed out |
3073 ms |
992 KB |
Time limit exceeded |
41 |
Halted |
0 ms |
0 KB |
- |