# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
129120 | 2019-07-11T17:18:02 Z | arnold518 | Lottery (CEOI18_lot) | C++14 | 1146 ms | 8352 KB |
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; const int MAXN = 1e4; int N, L, Q, A[MAXN+10], query[MAXN+10], ans[110][MAXN+10]; vector<int> V; int main() { int i, j; scanf("%d%d", &N, &L); for(i=1; i<=N; i++) scanf("%d", &A[i]); scanf("%d", &Q); for(i=1; i<=Q; i++) scanf("%d", &query[i]), V.push_back(query[i]); sort(V.begin(), V.end()); V.erase(unique(V.begin(), V.end()), V.end()); for(i=L+1; i<=N; i++) { int now=0; for(j=1; j<=L; j++) now+=(A[j]!=A[i-L+j]); int it=lower_bound(V.begin(), V.end(), now)-V.begin(); if(it!=V.size()) ans[it][1]++, ans[it][i-L+1]++; for(j=i+1; j<=N; j++) { now-=(A[j-i]!=A[j-L]); now+=(A[L+j-i]!=A[j]); int it=lower_bound(V.begin(), V.end(), now)-V.begin(); if(it!=V.size()) ans[it][1+j-i]++, ans[it][j-L+1]++; } } for(i=1; i<V.size(); i++) { for(j=1; j<=N-L+1; j++) ans[i][j]+=ans[i-1][j]; } for(i=1; i<=Q; i++) { int it=lower_bound(V.begin(), V.end(), query[i])-V.begin(); for(j=1; j<=N-L+1; j++) printf("%d ", ans[it][j]); printf("\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 | 2 ms | 504 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 | 376 KB | Output is correct |
9 | Correct | 3 ms | 504 KB | Output is correct |
10 | Correct | 3 ms | 376 KB | Output is correct |
11 | Correct | 3 ms | 376 KB | Output is correct |
12 | Correct | 3 ms | 376 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 | 2 ms | 504 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 | 376 KB | Output is correct |
9 | Correct | 3 ms | 504 KB | Output is correct |
10 | Correct | 3 ms | 376 KB | Output is correct |
11 | Correct | 3 ms | 376 KB | Output is correct |
12 | Correct | 3 ms | 376 KB | Output is correct |
13 | Correct | 23 ms | 376 KB | Output is correct |
14 | Correct | 15 ms | 504 KB | Output is correct |
15 | Correct | 12 ms | 504 KB | Output is correct |
16 | Correct | 21 ms | 632 KB | Output is correct |
17 | Correct | 19 ms | 632 KB | Output is correct |
18 | Correct | 19 ms | 632 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 287 ms | 504 KB | Output is correct |
2 | Correct | 213 ms | 504 KB | Output is correct |
3 | Correct | 203 ms | 472 KB | Output is correct |
4 | Correct | 199 ms | 504 KB | Output is correct |
5 | Correct | 77 ms | 504 KB | Output is correct |
6 | Correct | 182 ms | 640 KB | Output is correct |
7 | Correct | 90 ms | 504 KB | Output is correct |
8 | Correct | 149 ms | 632 KB | Output is correct |
9 | Correct | 195 ms | 504 KB | Output is correct |
10 | Correct | 198 ms | 536 KB | Output is correct |
11 | Correct | 12 ms | 376 KB | Output is correct |
12 | Correct | 113 ms | 504 KB | Output is correct |
13 | Correct | 96 ms | 632 KB | Output is correct |
14 | Correct | 96 ms | 504 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 287 ms | 504 KB | Output is correct |
2 | Correct | 213 ms | 504 KB | Output is correct |
3 | Correct | 203 ms | 472 KB | Output is correct |
4 | Correct | 199 ms | 504 KB | Output is correct |
5 | Correct | 77 ms | 504 KB | Output is correct |
6 | Correct | 182 ms | 640 KB | Output is correct |
7 | Correct | 90 ms | 504 KB | Output is correct |
8 | Correct | 149 ms | 632 KB | Output is correct |
9 | Correct | 195 ms | 504 KB | Output is correct |
10 | Correct | 198 ms | 536 KB | Output is correct |
11 | Correct | 12 ms | 376 KB | Output is correct |
12 | Correct | 113 ms | 504 KB | Output is correct |
13 | Correct | 96 ms | 632 KB | Output is correct |
14 | Correct | 96 ms | 504 KB | Output is correct |
15 | Correct | 232 ms | 464 KB | Output is correct |
16 | Correct | 174 ms | 504 KB | Output is correct |
17 | Correct | 210 ms | 552 KB | Output is correct |
18 | Correct | 202 ms | 504 KB | Output is correct |
19 | Correct | 200 ms | 552 KB | Output is correct |
20 | Correct | 203 ms | 504 KB | Output is correct |
21 | Correct | 200 ms | 632 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 | 2 ms | 504 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 | 376 KB | Output is correct |
9 | Correct | 3 ms | 504 KB | Output is correct |
10 | Correct | 3 ms | 376 KB | Output is correct |
11 | Correct | 3 ms | 376 KB | Output is correct |
12 | Correct | 3 ms | 376 KB | Output is correct |
13 | Correct | 23 ms | 376 KB | Output is correct |
14 | Correct | 15 ms | 504 KB | Output is correct |
15 | Correct | 12 ms | 504 KB | Output is correct |
16 | Correct | 21 ms | 632 KB | Output is correct |
17 | Correct | 19 ms | 632 KB | Output is correct |
18 | Correct | 19 ms | 632 KB | Output is correct |
19 | Correct | 287 ms | 504 KB | Output is correct |
20 | Correct | 213 ms | 504 KB | Output is correct |
21 | Correct | 203 ms | 472 KB | Output is correct |
22 | Correct | 199 ms | 504 KB | Output is correct |
23 | Correct | 77 ms | 504 KB | Output is correct |
24 | Correct | 182 ms | 640 KB | Output is correct |
25 | Correct | 90 ms | 504 KB | Output is correct |
26 | Correct | 149 ms | 632 KB | Output is correct |
27 | Correct | 195 ms | 504 KB | Output is correct |
28 | Correct | 198 ms | 536 KB | Output is correct |
29 | Correct | 12 ms | 376 KB | Output is correct |
30 | Correct | 113 ms | 504 KB | Output is correct |
31 | Correct | 96 ms | 632 KB | Output is correct |
32 | Correct | 96 ms | 504 KB | Output is correct |
33 | Correct | 232 ms | 464 KB | Output is correct |
34 | Correct | 174 ms | 504 KB | Output is correct |
35 | Correct | 210 ms | 552 KB | Output is correct |
36 | Correct | 202 ms | 504 KB | Output is correct |
37 | Correct | 200 ms | 552 KB | Output is correct |
38 | Correct | 203 ms | 504 KB | Output is correct |
39 | Correct | 200 ms | 632 KB | Output is correct |
40 | Correct | 607 ms | 1920 KB | Output is correct |
41 | Correct | 19 ms | 632 KB | Output is correct |
42 | Correct | 478 ms | 2012 KB | Output is correct |
43 | Correct | 448 ms | 1660 KB | Output is correct |
44 | Correct | 464 ms | 1656 KB | Output is correct |
45 | Correct | 1146 ms | 8104 KB | Output is correct |
46 | Correct | 28 ms | 1528 KB | Output is correct |
47 | Correct | 853 ms | 8352 KB | Output is correct |
48 | Correct | 674 ms | 6136 KB | Output is correct |
49 | Correct | 676 ms | 6752 KB | Output is correct |