# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
155649 | 2019-09-29T14:46:46 Z | karma | Lottery (CEOI18_lot) | C++14 | 808 ms | 8152 KB |
#include<bits/stdc++.h> #define Task "test" #define pb emplace_back using namespace std; const int N = int(1e4) + 1; int f[N][102], pre[N], a[N], pos[N], cnt; int n, l, lim, q, k[N]; bool vis[N]; int main() { ios_base::sync_with_stdio(0); cin.tie(0), cout.tie(0); if(fopen(Task".inp", "r")) { freopen(Task".inp", "r", stdin); freopen(Task".out", "w", stdout); } cin >> n >> l; lim = n - l + 1; for(int i = 1; i <= n; ++i) cin >> a[i]; cin >> q; for(int i = 1; i <= q; ++i) cin >> k[i], vis[k[i]] = 1; cnt = 1; for(int i = 0; i <= l; ++i) { pos[i] = cnt; if(vis[i]) ++cnt; } for(int j = 1; j <= lim; ++j) { for(int i = 1; i <= n; ++i) { if(i + j > n) break; if(a[i] != a[i + j]) pre[i] = pre[i - 1] + 1; else pre[i] = pre[i - 1]; } for(int i = 0; i < lim; ++i) { if(i + j + l > n) break; ++f[i + 1][pos[pre[i + l] - pre[i]]]; ++f[i + j + 1][pos[pre[i + l] - pre[i]]]; } } for(int j = 0; j <= cnt; ++j) { for(int i = 1; i <= lim; ++i) f[i][j] += f[i][j - 1]; } for(int j = 1; j <= q; ++j) { for(int i = 1; i <= lim; ++i) cout << f[i][pos[k[j]]] << ' '; cout << '\n'; } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 3 ms | 380 KB | Output is correct |
4 | Correct | 2 ms | 376 KB | Output is correct |
5 | Correct | 2 ms | 376 KB | Output is correct |
6 | Correct | 2 ms | 376 KB | Output is correct |
7 | Correct | 2 ms | 376 KB | Output is correct |
8 | Correct | 3 ms | 504 KB | Output is correct |
9 | Correct | 3 ms | 504 KB | Output is correct |
10 | Correct | 3 ms | 504 KB | Output is correct |
11 | Correct | 3 ms | 504 KB | Output is correct |
12 | Correct | 3 ms | 504 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 3 ms | 380 KB | Output is correct |
4 | Correct | 2 ms | 376 KB | Output is correct |
5 | Correct | 2 ms | 376 KB | Output is correct |
6 | Correct | 2 ms | 376 KB | Output is correct |
7 | Correct | 2 ms | 376 KB | Output is correct |
8 | Correct | 3 ms | 504 KB | Output is correct |
9 | Correct | 3 ms | 504 KB | Output is correct |
10 | Correct | 3 ms | 504 KB | Output is correct |
11 | Correct | 3 ms | 504 KB | Output is correct |
12 | Correct | 3 ms | 504 KB | Output is correct |
13 | Correct | 23 ms | 1272 KB | Output is correct |
14 | Correct | 16 ms | 1016 KB | Output is correct |
15 | Correct | 15 ms | 888 KB | Output is correct |
16 | Correct | 22 ms | 1144 KB | Output is correct |
17 | Correct | 20 ms | 1144 KB | Output is correct |
18 | Correct | 20 ms | 1144 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 704 ms | 4456 KB | Output is correct |
2 | Correct | 708 ms | 4492 KB | Output is correct |
3 | Correct | 524 ms | 4488 KB | Output is correct |
4 | Correct | 533 ms | 4496 KB | Output is correct |
5 | Correct | 189 ms | 2552 KB | Output is correct |
6 | Correct | 471 ms | 4316 KB | Output is correct |
7 | Correct | 178 ms | 2552 KB | Output is correct |
8 | Correct | 291 ms | 3448 KB | Output is correct |
9 | Correct | 502 ms | 4472 KB | Output is correct |
10 | Correct | 508 ms | 4572 KB | Output is correct |
11 | Correct | 28 ms | 1144 KB | Output is correct |
12 | Correct | 289 ms | 3448 KB | Output is correct |
13 | Correct | 244 ms | 2828 KB | Output is correct |
14 | Correct | 246 ms | 3068 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 704 ms | 4456 KB | Output is correct |
2 | Correct | 708 ms | 4492 KB | Output is correct |
3 | Correct | 524 ms | 4488 KB | Output is correct |
4 | Correct | 533 ms | 4496 KB | Output is correct |
5 | Correct | 189 ms | 2552 KB | Output is correct |
6 | Correct | 471 ms | 4316 KB | Output is correct |
7 | Correct | 178 ms | 2552 KB | Output is correct |
8 | Correct | 291 ms | 3448 KB | Output is correct |
9 | Correct | 502 ms | 4472 KB | Output is correct |
10 | Correct | 508 ms | 4572 KB | Output is correct |
11 | Correct | 28 ms | 1144 KB | Output is correct |
12 | Correct | 289 ms | 3448 KB | Output is correct |
13 | Correct | 244 ms | 2828 KB | Output is correct |
14 | Correct | 246 ms | 3068 KB | Output is correct |
15 | Correct | 505 ms | 4368 KB | Output is correct |
16 | Correct | 451 ms | 4172 KB | Output is correct |
17 | Correct | 531 ms | 4600 KB | Output is correct |
18 | Correct | 511 ms | 4516 KB | Output is correct |
19 | Correct | 524 ms | 4544 KB | Output is correct |
20 | Correct | 508 ms | 4600 KB | Output is correct |
21 | Correct | 517 ms | 4524 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 3 ms | 380 KB | Output is correct |
4 | Correct | 2 ms | 376 KB | Output is correct |
5 | Correct | 2 ms | 376 KB | Output is correct |
6 | Correct | 2 ms | 376 KB | Output is correct |
7 | Correct | 2 ms | 376 KB | Output is correct |
8 | Correct | 3 ms | 504 KB | Output is correct |
9 | Correct | 3 ms | 504 KB | Output is correct |
10 | Correct | 3 ms | 504 KB | Output is correct |
11 | Correct | 3 ms | 504 KB | Output is correct |
12 | Correct | 3 ms | 504 KB | Output is correct |
13 | Correct | 23 ms | 1272 KB | Output is correct |
14 | Correct | 16 ms | 1016 KB | Output is correct |
15 | Correct | 15 ms | 888 KB | Output is correct |
16 | Correct | 22 ms | 1144 KB | Output is correct |
17 | Correct | 20 ms | 1144 KB | Output is correct |
18 | Correct | 20 ms | 1144 KB | Output is correct |
19 | Correct | 704 ms | 4456 KB | Output is correct |
20 | Correct | 708 ms | 4492 KB | Output is correct |
21 | Correct | 524 ms | 4488 KB | Output is correct |
22 | Correct | 533 ms | 4496 KB | Output is correct |
23 | Correct | 189 ms | 2552 KB | Output is correct |
24 | Correct | 471 ms | 4316 KB | Output is correct |
25 | Correct | 178 ms | 2552 KB | Output is correct |
26 | Correct | 291 ms | 3448 KB | Output is correct |
27 | Correct | 502 ms | 4472 KB | Output is correct |
28 | Correct | 508 ms | 4572 KB | Output is correct |
29 | Correct | 28 ms | 1144 KB | Output is correct |
30 | Correct | 289 ms | 3448 KB | Output is correct |
31 | Correct | 244 ms | 2828 KB | Output is correct |
32 | Correct | 246 ms | 3068 KB | Output is correct |
33 | Correct | 505 ms | 4368 KB | Output is correct |
34 | Correct | 451 ms | 4172 KB | Output is correct |
35 | Correct | 531 ms | 4600 KB | Output is correct |
36 | Correct | 511 ms | 4516 KB | Output is correct |
37 | Correct | 524 ms | 4544 KB | Output is correct |
38 | Correct | 508 ms | 4600 KB | Output is correct |
39 | Correct | 517 ms | 4524 KB | Output is correct |
40 | Correct | 724 ms | 5344 KB | Output is correct |
41 | Correct | 35 ms | 1016 KB | Output is correct |
42 | Correct | 542 ms | 5220 KB | Output is correct |
43 | Correct | 505 ms | 4856 KB | Output is correct |
44 | Correct | 504 ms | 4904 KB | Output is correct |
45 | Correct | 808 ms | 8152 KB | Output is correct |
46 | Incorrect | 42 ms | 1400 KB | Output isn't correct |
47 | Halted | 0 ms | 0 KB | - |