# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
217521 | 2020-03-30T06:07:09 Z | DystoriaX | Lottery (CEOI18_lot) | C++14 | 1334 ms | 8440 KB |
#include <bits/stdc++.h> using namespace std; int n, l; int a[10010], b[10010]; int cnt[110][10010]; int q, qr[110]; vector<int> cmp; int main(){ scanf("%d%d", &n, &l); for(int i = 1; i <= n; i++) scanf("%d", &a[i]), b[i] = a[i]; scanf("%d", &q); for(int i = 1; i <= q; i++){ scanf("%d", &qr[i]); cmp.emplace_back(qr[i]); } sort(cmp.begin(), cmp.end()); for(int d = 1; d < n - l + 1; d++){ int diff = 0; for(int j = 1; j <= l; j++){ if(a[j] != a[j + d]) diff++; } auto it = upper_bound(cmp.begin(), cmp.end(), diff - 1) - cmp.begin(); cnt[it][1]++; cnt[it][d + 1]++; for(int i = 2; i + l + d - 1 <= n; i++){ if(a[i - 1] != a[i + d - 1]) diff--; if(a[i + l - 1] != a[i + l - 1 + d]) diff++; // cout << "Comparing " << i + l - 1 << " with " << i + l + d - it = upper_bound(cmp.begin(), cmp.end(), diff - 1) - cmp.begin(); cnt[it][i]++; cnt[it][i + d]++; } } for(int i = 1; i <= n; i++){ for(int k = 1; k <= q; k++) cnt[k][i] += cnt[k - 1][i]; } for(int i = 1; i <= q; i++){ auto it = upper_bound(cmp.begin(), cmp.end(), qr[i] - 1) - cmp.begin(); for(int j = 1; j <= n - l + 1; j++){ printf("%d ", cnt[it][j]); } printf("\n"); } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 384 KB | Output is correct |
2 | Correct | 5 ms | 384 KB | Output is correct |
3 | Correct | 5 ms | 512 KB | Output is correct |
4 | Correct | 4 ms | 384 KB | Output is correct |
5 | Correct | 4 ms | 384 KB | Output is correct |
6 | Correct | 5 ms | 384 KB | Output is correct |
7 | Correct | 5 ms | 384 KB | Output is correct |
8 | Correct | 5 ms | 512 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 | 416 KB | Output is correct |
12 | Correct | 6 ms | 512 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 384 KB | Output is correct |
2 | Correct | 5 ms | 384 KB | Output is correct |
3 | Correct | 5 ms | 512 KB | Output is correct |
4 | Correct | 4 ms | 384 KB | Output is correct |
5 | Correct | 4 ms | 384 KB | Output is correct |
6 | Correct | 5 ms | 384 KB | Output is correct |
7 | Correct | 5 ms | 384 KB | Output is correct |
8 | Correct | 5 ms | 512 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 | 416 KB | Output is correct |
12 | Correct | 6 ms | 512 KB | Output is correct |
13 | Correct | 25 ms | 384 KB | Output is correct |
14 | Correct | 17 ms | 640 KB | Output is correct |
15 | Correct | 16 ms | 512 KB | Output is correct |
16 | Correct | 26 ms | 640 KB | Output is correct |
17 | Correct | 24 ms | 640 KB | Output is correct |
18 | Correct | 27 ms | 656 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 562 ms | 512 KB | Output is correct |
2 | Correct | 596 ms | 632 KB | Output is correct |
3 | Correct | 410 ms | 512 KB | Output is correct |
4 | Correct | 353 ms | 768 KB | Output is correct |
5 | Correct | 115 ms | 512 KB | Output is correct |
6 | Correct | 322 ms | 632 KB | Output is correct |
7 | Correct | 63 ms | 632 KB | Output is correct |
8 | Correct | 101 ms | 632 KB | Output is correct |
9 | Correct | 337 ms | 632 KB | Output is correct |
10 | Correct | 351 ms | 632 KB | Output is correct |
11 | Correct | 26 ms | 384 KB | Output is correct |
12 | Correct | 209 ms | 512 KB | Output is correct |
13 | Correct | 155 ms | 632 KB | Output is correct |
14 | Correct | 164 ms | 632 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 562 ms | 512 KB | Output is correct |
2 | Correct | 596 ms | 632 KB | Output is correct |
3 | Correct | 410 ms | 512 KB | Output is correct |
4 | Correct | 353 ms | 768 KB | Output is correct |
5 | Correct | 115 ms | 512 KB | Output is correct |
6 | Correct | 322 ms | 632 KB | Output is correct |
7 | Correct | 63 ms | 632 KB | Output is correct |
8 | Correct | 101 ms | 632 KB | Output is correct |
9 | Correct | 337 ms | 632 KB | Output is correct |
10 | Correct | 351 ms | 632 KB | Output is correct |
11 | Correct | 26 ms | 384 KB | Output is correct |
12 | Correct | 209 ms | 512 KB | Output is correct |
13 | Correct | 155 ms | 632 KB | Output is correct |
14 | Correct | 164 ms | 632 KB | Output is correct |
15 | Correct | 339 ms | 512 KB | Output is correct |
16 | Correct | 305 ms | 636 KB | Output is correct |
17 | Correct | 374 ms | 636 KB | Output is correct |
18 | Correct | 361 ms | 632 KB | Output is correct |
19 | Correct | 358 ms | 632 KB | Output is correct |
20 | Correct | 365 ms | 632 KB | Output is correct |
21 | Correct | 359 ms | 632 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 384 KB | Output is correct |
2 | Correct | 5 ms | 384 KB | Output is correct |
3 | Correct | 5 ms | 512 KB | Output is correct |
4 | Correct | 4 ms | 384 KB | Output is correct |
5 | Correct | 4 ms | 384 KB | Output is correct |
6 | Correct | 5 ms | 384 KB | Output is correct |
7 | Correct | 5 ms | 384 KB | Output is correct |
8 | Correct | 5 ms | 512 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 | 416 KB | Output is correct |
12 | Correct | 6 ms | 512 KB | Output is correct |
13 | Correct | 25 ms | 384 KB | Output is correct |
14 | Correct | 17 ms | 640 KB | Output is correct |
15 | Correct | 16 ms | 512 KB | Output is correct |
16 | Correct | 26 ms | 640 KB | Output is correct |
17 | Correct | 24 ms | 640 KB | Output is correct |
18 | Correct | 27 ms | 656 KB | Output is correct |
19 | Correct | 562 ms | 512 KB | Output is correct |
20 | Correct | 596 ms | 632 KB | Output is correct |
21 | Correct | 410 ms | 512 KB | Output is correct |
22 | Correct | 353 ms | 768 KB | Output is correct |
23 | Correct | 115 ms | 512 KB | Output is correct |
24 | Correct | 322 ms | 632 KB | Output is correct |
25 | Correct | 63 ms | 632 KB | Output is correct |
26 | Correct | 101 ms | 632 KB | Output is correct |
27 | Correct | 337 ms | 632 KB | Output is correct |
28 | Correct | 351 ms | 632 KB | Output is correct |
29 | Correct | 26 ms | 384 KB | Output is correct |
30 | Correct | 209 ms | 512 KB | Output is correct |
31 | Correct | 155 ms | 632 KB | Output is correct |
32 | Correct | 164 ms | 632 KB | Output is correct |
33 | Correct | 339 ms | 512 KB | Output is correct |
34 | Correct | 305 ms | 636 KB | Output is correct |
35 | Correct | 374 ms | 636 KB | Output is correct |
36 | Correct | 361 ms | 632 KB | Output is correct |
37 | Correct | 358 ms | 632 KB | Output is correct |
38 | Correct | 365 ms | 632 KB | Output is correct |
39 | Correct | 359 ms | 632 KB | Output is correct |
40 | Correct | 1030 ms | 2040 KB | Output is correct |
41 | Correct | 19 ms | 1408 KB | Output is correct |
42 | Correct | 573 ms | 2040 KB | Output is correct |
43 | Correct | 538 ms | 1784 KB | Output is correct |
44 | Correct | 543 ms | 1912 KB | Output is correct |
45 | Correct | 1334 ms | 8184 KB | Output is correct |
46 | Correct | 31 ms | 4728 KB | Output is correct |
47 | Correct | 790 ms | 8440 KB | Output is correct |
48 | Correct | 725 ms | 6520 KB | Output is correct |
49 | Correct | 722 ms | 7160 KB | Output is correct |