# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1090144 |
2024-09-17T19:38:25 Z |
ZeroCool |
Lottery (CEOI18_lot) |
C++14 |
|
334 ms |
8528 KB |
#include <bits/stdc++.h>
using namespace std;
//#define int long long
#define ll long long
#define ar array
//const int INF = 1e17;
const int N = 1e4 + 5;
const int Q = 105;
const int MOD = 1e9 + 7;
int A[N], que[N], B[Q], id[N], pref[N], ans[N][Q];
signed main(){ios_base::sync_with_stdio(false);cin.tie(0);
int n, l;
cin>>n>>l;
for(int i = 1;i <= n;i++)cin>>A[i];
int q;
cin>>q;
for(int i = 1;i <= q;i++){
cin>>que[i];
//--que[i];
B[i] = que[i];
}
sort(B + 1, B + q + 1);
int j = 0;
for(int i = 1;i <= n;i++){
while(j <= q && B[j] < i)j++;
id[i] = j;
//cout<<id[i]<<" ";
}
// cout<<'\n';
for(int d = 1;d <= n;d++){
for(int i = 1;i + d <= n;i++){
pref[i] = (A[i] != A[i + d]);
if(i)pref[i] += pref[i - 1];
}
for(int i = 1;i + d + l - 1 <= n;i++){
int k = pref[i + l - 1];
if(i)k -= pref[i - 1];
ans[i][id[k]]++;
ans[i + d][id[k]]++;
}
}
for(int i = 1;i <= n;i++){
for(int j = 1;j <= q;j++)ans[i][j] += ans[i][j - 1];
}
for(int i = 1;i <= q;i++){
for(int j = 1;j + l -1 <= n;j++){
cout<<ans[j][id[que[i]]]<<" ";
}
cout<<'\n';
}
}
//! MI SE SPIEEEEE!
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
1 ms |
604 KB |
Output is correct |
9 |
Correct |
1 ms |
456 KB |
Output is correct |
10 |
Correct |
1 ms |
604 KB |
Output is correct |
11 |
Correct |
1 ms |
464 KB |
Output is correct |
12 |
Correct |
1 ms |
604 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
1 ms |
604 KB |
Output is correct |
9 |
Correct |
1 ms |
456 KB |
Output is correct |
10 |
Correct |
1 ms |
604 KB |
Output is correct |
11 |
Correct |
1 ms |
464 KB |
Output is correct |
12 |
Correct |
1 ms |
604 KB |
Output is correct |
13 |
Correct |
11 ms |
1116 KB |
Output is correct |
14 |
Correct |
9 ms |
1324 KB |
Output is correct |
15 |
Correct |
8 ms |
1372 KB |
Output is correct |
16 |
Correct |
11 ms |
1424 KB |
Output is correct |
17 |
Correct |
11 ms |
1372 KB |
Output is correct |
18 |
Correct |
11 ms |
1372 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
296 ms |
4952 KB |
Output is correct |
2 |
Correct |
285 ms |
4700 KB |
Output is correct |
3 |
Correct |
299 ms |
4704 KB |
Output is correct |
4 |
Correct |
286 ms |
4700 KB |
Output is correct |
5 |
Correct |
163 ms |
4688 KB |
Output is correct |
6 |
Correct |
262 ms |
4732 KB |
Output is correct |
7 |
Correct |
160 ms |
4692 KB |
Output is correct |
8 |
Correct |
203 ms |
4688 KB |
Output is correct |
9 |
Correct |
276 ms |
4624 KB |
Output is correct |
10 |
Correct |
282 ms |
4700 KB |
Output is correct |
11 |
Correct |
17 ms |
1628 KB |
Output is correct |
12 |
Correct |
176 ms |
4276 KB |
Output is correct |
13 |
Correct |
177 ms |
4692 KB |
Output is correct |
14 |
Correct |
178 ms |
4696 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
296 ms |
4952 KB |
Output is correct |
2 |
Correct |
285 ms |
4700 KB |
Output is correct |
3 |
Correct |
299 ms |
4704 KB |
Output is correct |
4 |
Correct |
286 ms |
4700 KB |
Output is correct |
5 |
Correct |
163 ms |
4688 KB |
Output is correct |
6 |
Correct |
262 ms |
4732 KB |
Output is correct |
7 |
Correct |
160 ms |
4692 KB |
Output is correct |
8 |
Correct |
203 ms |
4688 KB |
Output is correct |
9 |
Correct |
276 ms |
4624 KB |
Output is correct |
10 |
Correct |
282 ms |
4700 KB |
Output is correct |
11 |
Correct |
17 ms |
1628 KB |
Output is correct |
12 |
Correct |
176 ms |
4276 KB |
Output is correct |
13 |
Correct |
177 ms |
4692 KB |
Output is correct |
14 |
Correct |
178 ms |
4696 KB |
Output is correct |
15 |
Correct |
278 ms |
4692 KB |
Output is correct |
16 |
Correct |
257 ms |
4608 KB |
Output is correct |
17 |
Correct |
288 ms |
4760 KB |
Output is correct |
18 |
Correct |
282 ms |
4716 KB |
Output is correct |
19 |
Correct |
285 ms |
4696 KB |
Output is correct |
20 |
Correct |
287 ms |
4700 KB |
Output is correct |
21 |
Correct |
290 ms |
4700 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
1 ms |
604 KB |
Output is correct |
9 |
Correct |
1 ms |
456 KB |
Output is correct |
10 |
Correct |
1 ms |
604 KB |
Output is correct |
11 |
Correct |
1 ms |
464 KB |
Output is correct |
12 |
Correct |
1 ms |
604 KB |
Output is correct |
13 |
Correct |
11 ms |
1116 KB |
Output is correct |
14 |
Correct |
9 ms |
1324 KB |
Output is correct |
15 |
Correct |
8 ms |
1372 KB |
Output is correct |
16 |
Correct |
11 ms |
1424 KB |
Output is correct |
17 |
Correct |
11 ms |
1372 KB |
Output is correct |
18 |
Correct |
11 ms |
1372 KB |
Output is correct |
19 |
Correct |
296 ms |
4952 KB |
Output is correct |
20 |
Correct |
285 ms |
4700 KB |
Output is correct |
21 |
Correct |
299 ms |
4704 KB |
Output is correct |
22 |
Correct |
286 ms |
4700 KB |
Output is correct |
23 |
Correct |
163 ms |
4688 KB |
Output is correct |
24 |
Correct |
262 ms |
4732 KB |
Output is correct |
25 |
Correct |
160 ms |
4692 KB |
Output is correct |
26 |
Correct |
203 ms |
4688 KB |
Output is correct |
27 |
Correct |
276 ms |
4624 KB |
Output is correct |
28 |
Correct |
282 ms |
4700 KB |
Output is correct |
29 |
Correct |
17 ms |
1628 KB |
Output is correct |
30 |
Correct |
176 ms |
4276 KB |
Output is correct |
31 |
Correct |
177 ms |
4692 KB |
Output is correct |
32 |
Correct |
178 ms |
4696 KB |
Output is correct |
33 |
Correct |
278 ms |
4692 KB |
Output is correct |
34 |
Correct |
257 ms |
4608 KB |
Output is correct |
35 |
Correct |
288 ms |
4760 KB |
Output is correct |
36 |
Correct |
282 ms |
4716 KB |
Output is correct |
37 |
Correct |
285 ms |
4696 KB |
Output is correct |
38 |
Correct |
287 ms |
4700 KB |
Output is correct |
39 |
Correct |
290 ms |
4700 KB |
Output is correct |
40 |
Correct |
296 ms |
5456 KB |
Output is correct |
41 |
Correct |
129 ms |
4680 KB |
Output is correct |
42 |
Correct |
303 ms |
5460 KB |
Output is correct |
43 |
Correct |
279 ms |
4948 KB |
Output is correct |
44 |
Correct |
279 ms |
5200 KB |
Output is correct |
45 |
Correct |
334 ms |
8504 KB |
Output is correct |
46 |
Correct |
132 ms |
4900 KB |
Output is correct |
47 |
Correct |
330 ms |
8528 KB |
Output is correct |
48 |
Correct |
315 ms |
6736 KB |
Output is correct |
49 |
Correct |
315 ms |
7508 KB |
Output is correct |