# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
104954 | 2019-04-10T00:22:18 Z | eriksuenderhauf | Lottery (CEOI18_lot) | C++11 | 1034 ms | 8284 KB |
#pragma GCC optimize("O3") #include <bits/stdc++.h> #define pii pair<int, int> #define mp make_pair #define se second using namespace std; const int MAXN = 1e4 + 5; int a[MAXN], cnt[MAXN]; pii qry[101]; int ans[101][MAXN]; int ind[101]; int main() { int n, l, q, k; scanf("%d %d", &n, &l); for (int i = 0; i < n; i++) scanf("%d", &a[i]); scanf("%d", &q); for (int i = 0; i < q; i++) { scanf("%d", &k); qry[i] = {k, i}; } sort(qry, qry + q); for (int j = 1; j < n - l + 1; j++) { int diff = 0; for (int m = 0; m < l; m++) diff += a[m] != a[j + m]; int st = lower_bound(qry, qry + q, mp(diff, 0)) - qry; ans[st][0]++, ans[st][j]++; for (int m = 1; j + l - 1 + m < n; m++) { diff -= a[m - 1] != a[j + m - 1]; diff += a[l - 1 + m] != a[j + l - 1 + m]; st = lower_bound(qry, qry + q, mp(diff, 0)) - qry; ans[st][m]++, ans[st][m + j]++; } } for (int i = 1; i < q; i++) { for (int j = 0; j < n; j++) ans[i][j] += ans[i - 1][j]; ind[qry[i].se] = i; } for (int i = 0; i < q; i++) { for (int j = 0; j < n - l + 1; j++) printf("%d ", ans[ind[i]][j]); printf("\n"); } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 384 KB | Output is correct |
2 | Correct | 2 ms | 384 KB | Output is correct |
3 | Correct | 3 ms | 384 KB | Output is correct |
4 | Correct | 2 ms | 384 KB | Output is correct |
5 | Correct | 2 ms | 384 KB | Output is correct |
6 | Correct | 3 ms | 384 KB | Output is correct |
7 | Correct | 3 ms | 384 KB | Output is correct |
8 | Correct | 3 ms | 384 KB | Output is correct |
9 | Correct | 3 ms | 512 KB | Output is correct |
10 | Correct | 4 ms | 512 KB | Output is correct |
11 | Correct | 3 ms | 384 KB | Output is correct |
12 | Correct | 4 ms | 384 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 384 KB | Output is correct |
2 | Correct | 2 ms | 384 KB | Output is correct |
3 | Correct | 3 ms | 384 KB | Output is correct |
4 | Correct | 2 ms | 384 KB | Output is correct |
5 | Correct | 2 ms | 384 KB | Output is correct |
6 | Correct | 3 ms | 384 KB | Output is correct |
7 | Correct | 3 ms | 384 KB | Output is correct |
8 | Correct | 3 ms | 384 KB | Output is correct |
9 | Correct | 3 ms | 512 KB | Output is correct |
10 | Correct | 4 ms | 512 KB | Output is correct |
11 | Correct | 3 ms | 384 KB | Output is correct |
12 | Correct | 4 ms | 384 KB | Output is correct |
13 | Correct | 21 ms | 504 KB | Output is correct |
14 | Correct | 11 ms | 640 KB | Output is correct |
15 | Correct | 10 ms | 484 KB | Output is correct |
16 | Correct | 17 ms | 768 KB | Output is correct |
17 | Correct | 21 ms | 640 KB | Output is correct |
18 | Correct | 22 ms | 640 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 388 ms | 544 KB | Output is correct |
2 | Correct | 290 ms | 536 KB | Output is correct |
3 | Correct | 270 ms | 540 KB | Output is correct |
4 | Correct | 273 ms | 632 KB | Output is correct |
5 | Correct | 78 ms | 632 KB | Output is correct |
6 | Correct | 274 ms | 632 KB | Output is correct |
7 | Correct | 70 ms | 512 KB | Output is correct |
8 | Correct | 124 ms | 532 KB | Output is correct |
9 | Correct | 242 ms | 632 KB | Output is correct |
10 | Correct | 260 ms | 632 KB | Output is correct |
11 | Correct | 13 ms | 384 KB | Output is correct |
12 | Correct | 135 ms | 632 KB | Output is correct |
13 | Correct | 101 ms | 632 KB | Output is correct |
14 | Correct | 102 ms | 640 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 388 ms | 544 KB | Output is correct |
2 | Correct | 290 ms | 536 KB | Output is correct |
3 | Correct | 270 ms | 540 KB | Output is correct |
4 | Correct | 273 ms | 632 KB | Output is correct |
5 | Correct | 78 ms | 632 KB | Output is correct |
6 | Correct | 274 ms | 632 KB | Output is correct |
7 | Correct | 70 ms | 512 KB | Output is correct |
8 | Correct | 124 ms | 532 KB | Output is correct |
9 | Correct | 242 ms | 632 KB | Output is correct |
10 | Correct | 260 ms | 632 KB | Output is correct |
11 | Correct | 13 ms | 384 KB | Output is correct |
12 | Correct | 135 ms | 632 KB | Output is correct |
13 | Correct | 101 ms | 632 KB | Output is correct |
14 | Correct | 102 ms | 640 KB | Output is correct |
15 | Correct | 230 ms | 544 KB | Output is correct |
16 | Correct | 204 ms | 632 KB | Output is correct |
17 | Correct | 307 ms | 632 KB | Output is correct |
18 | Correct | 288 ms | 772 KB | Output is correct |
19 | Correct | 247 ms | 632 KB | Output is correct |
20 | Correct | 268 ms | 604 KB | Output is correct |
21 | Correct | 248 ms | 632 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 384 KB | Output is correct |
2 | Correct | 2 ms | 384 KB | Output is correct |
3 | Correct | 3 ms | 384 KB | Output is correct |
4 | Correct | 2 ms | 384 KB | Output is correct |
5 | Correct | 2 ms | 384 KB | Output is correct |
6 | Correct | 3 ms | 384 KB | Output is correct |
7 | Correct | 3 ms | 384 KB | Output is correct |
8 | Correct | 3 ms | 384 KB | Output is correct |
9 | Correct | 3 ms | 512 KB | Output is correct |
10 | Correct | 4 ms | 512 KB | Output is correct |
11 | Correct | 3 ms | 384 KB | Output is correct |
12 | Correct | 4 ms | 384 KB | Output is correct |
13 | Correct | 21 ms | 504 KB | Output is correct |
14 | Correct | 11 ms | 640 KB | Output is correct |
15 | Correct | 10 ms | 484 KB | Output is correct |
16 | Correct | 17 ms | 768 KB | Output is correct |
17 | Correct | 21 ms | 640 KB | Output is correct |
18 | Correct | 22 ms | 640 KB | Output is correct |
19 | Correct | 388 ms | 544 KB | Output is correct |
20 | Correct | 290 ms | 536 KB | Output is correct |
21 | Correct | 270 ms | 540 KB | Output is correct |
22 | Correct | 273 ms | 632 KB | Output is correct |
23 | Correct | 78 ms | 632 KB | Output is correct |
24 | Correct | 274 ms | 632 KB | Output is correct |
25 | Correct | 70 ms | 512 KB | Output is correct |
26 | Correct | 124 ms | 532 KB | Output is correct |
27 | Correct | 242 ms | 632 KB | Output is correct |
28 | Correct | 260 ms | 632 KB | Output is correct |
29 | Correct | 13 ms | 384 KB | Output is correct |
30 | Correct | 135 ms | 632 KB | Output is correct |
31 | Correct | 101 ms | 632 KB | Output is correct |
32 | Correct | 102 ms | 640 KB | Output is correct |
33 | Correct | 230 ms | 544 KB | Output is correct |
34 | Correct | 204 ms | 632 KB | Output is correct |
35 | Correct | 307 ms | 632 KB | Output is correct |
36 | Correct | 288 ms | 772 KB | Output is correct |
37 | Correct | 247 ms | 632 KB | Output is correct |
38 | Correct | 268 ms | 604 KB | Output is correct |
39 | Correct | 248 ms | 632 KB | Output is correct |
40 | Correct | 676 ms | 1932 KB | Output is correct |
41 | Correct | 14 ms | 1280 KB | Output is correct |
42 | Correct | 488 ms | 2072 KB | Output is correct |
43 | Correct | 419 ms | 1784 KB | Output is correct |
44 | Correct | 391 ms | 1912 KB | Output is correct |
45 | Correct | 1034 ms | 8184 KB | Output is correct |
46 | Correct | 22 ms | 4728 KB | Output is correct |
47 | Correct | 688 ms | 8284 KB | Output is correct |
48 | Correct | 584 ms | 6520 KB | Output is correct |
49 | Correct | 603 ms | 7160 KB | Output is correct |