# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
148093 | 2019-08-31T13:49:23 Z | WhipppedCream | Lottery (CEOI18_lot) | C++17 | 1438 ms | 12280 KB |
#include <bits/stdc++.h> using namespace std; #define X first #define Y second #define pb push_back typedef pair<int, int> ii; typedef long long ll; const int maxn = 1e4+5; int arr[maxn]; int mark[maxn]; int n; int k[105]; int tt[105]; int ezreal[105][maxn]; int ans[105][maxn]; int main() { scanf("%d", &n); int L; scanf("%d", &L); for(int i = 1; i<= n; i++) scanf("%d", arr+i); int q; scanf("%d", &q); for(int i = 1; i<= q; i++) scanf("%d", &k[i]); vector< ii > wtf; wtf.pb(ii(-1e9, 0)); for(int i = 1; i<= q; i++) { wtf.pb(ii(k[i], i)); } sort(wtf.begin(), wtf.end()); for(int i = 1; i<= q; i++) tt[i] = wtf[i].X; for(int diff = 1; diff<= n-1; diff++) { memset(mark, 0, sizeof mark); int run = 0; for(int j = n; j-diff>= 1; j--) { int i = j-diff; if(mark[i]) run--; if(arr[i] == arr[j]) { run++; if(i-L>= 1) mark[i-L] = true; } //printf("mis[%d][%d] = %d\n", i, j, L-run); if(i+L-1<=n && j+L-1<= n) { int from = lower_bound(tt+1, tt+q+1, L-run)-tt; //printf("from %d (%d %d: %d)\n", from, i, j, L-run); ans[from][i]++; ans[from][j]++; } } } // for(int i = 1; i<= q; i++) // { // for(int j = 1; j+L-1<= n; j++) // { // printf("%d ", ans[i][j]); // } // printf("\n"); // } for(int i = 1; i+L-1<= n; i++) { for(int j = 2; j<= q; j++) { ans[j][i] += ans[j-1][i]; } } for(int i = 1; i<= q; i++) { for(int j = 1; j+L-1<= n; j++) { ezreal[wtf[i].Y][j] = ans[i][j]; } } for(int i = 1; i<= q; i++) { for(int j = 1; j+L-1<= n; j++) { printf("%d ", ezreal[i][j]); } printf("\n"); } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 508 KB | Output is correct |
3 | Correct | 3 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 | 504 KB | Output is correct |
7 | Correct | 3 ms | 504 KB | Output is correct |
8 | Correct | 4 ms | 632 KB | Output is correct |
9 | Correct | 4 ms | 504 KB | Output is correct |
10 | Correct | 4 ms | 632 KB | Output is correct |
11 | Correct | 4 ms | 632 KB | Output is correct |
12 | Correct | 4 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 | 508 KB | Output is correct |
3 | Correct | 3 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 | 504 KB | Output is correct |
7 | Correct | 3 ms | 504 KB | Output is correct |
8 | Correct | 4 ms | 632 KB | Output is correct |
9 | Correct | 4 ms | 504 KB | Output is correct |
10 | Correct | 4 ms | 632 KB | Output is correct |
11 | Correct | 4 ms | 632 KB | Output is correct |
12 | Correct | 4 ms | 632 KB | Output is correct |
13 | Correct | 31 ms | 512 KB | Output is correct |
14 | Correct | 23 ms | 952 KB | Output is correct |
15 | Correct | 21 ms | 584 KB | Output is correct |
16 | Correct | 34 ms | 888 KB | Output is correct |
17 | Correct | 31 ms | 888 KB | Output is correct |
18 | Correct | 31 ms | 904 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 719 ms | 632 KB | Output is correct |
2 | Correct | 723 ms | 548 KB | Output is correct |
3 | Correct | 533 ms | 548 KB | Output is correct |
4 | Correct | 473 ms | 632 KB | Output is correct |
5 | Correct | 217 ms | 632 KB | Output is correct |
6 | Correct | 435 ms | 636 KB | Output is correct |
7 | Correct | 181 ms | 568 KB | Output is correct |
8 | Correct | 223 ms | 572 KB | Output is correct |
9 | Correct | 457 ms | 632 KB | Output is correct |
10 | Correct | 465 ms | 632 KB | Output is correct |
11 | Correct | 38 ms | 504 KB | Output is correct |
12 | Correct | 294 ms | 604 KB | Output is correct |
13 | Correct | 257 ms | 604 KB | Output is correct |
14 | Correct | 275 ms | 504 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 719 ms | 632 KB | Output is correct |
2 | Correct | 723 ms | 548 KB | Output is correct |
3 | Correct | 533 ms | 548 KB | Output is correct |
4 | Correct | 473 ms | 632 KB | Output is correct |
5 | Correct | 217 ms | 632 KB | Output is correct |
6 | Correct | 435 ms | 636 KB | Output is correct |
7 | Correct | 181 ms | 568 KB | Output is correct |
8 | Correct | 223 ms | 572 KB | Output is correct |
9 | Correct | 457 ms | 632 KB | Output is correct |
10 | Correct | 465 ms | 632 KB | Output is correct |
11 | Correct | 38 ms | 504 KB | Output is correct |
12 | Correct | 294 ms | 604 KB | Output is correct |
13 | Correct | 257 ms | 604 KB | Output is correct |
14 | Correct | 275 ms | 504 KB | Output is correct |
15 | Correct | 444 ms | 540 KB | Output is correct |
16 | Correct | 414 ms | 632 KB | Output is correct |
17 | Correct | 491 ms | 660 KB | Output is correct |
18 | Correct | 481 ms | 636 KB | Output is correct |
19 | Correct | 476 ms | 632 KB | Output is correct |
20 | Correct | 480 ms | 628 KB | Output is correct |
21 | Correct | 478 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 | 508 KB | Output is correct |
3 | Correct | 3 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 | 504 KB | Output is correct |
7 | Correct | 3 ms | 504 KB | Output is correct |
8 | Correct | 4 ms | 632 KB | Output is correct |
9 | Correct | 4 ms | 504 KB | Output is correct |
10 | Correct | 4 ms | 632 KB | Output is correct |
11 | Correct | 4 ms | 632 KB | Output is correct |
12 | Correct | 4 ms | 632 KB | Output is correct |
13 | Correct | 31 ms | 512 KB | Output is correct |
14 | Correct | 23 ms | 952 KB | Output is correct |
15 | Correct | 21 ms | 584 KB | Output is correct |
16 | Correct | 34 ms | 888 KB | Output is correct |
17 | Correct | 31 ms | 888 KB | Output is correct |
18 | Correct | 31 ms | 904 KB | Output is correct |
19 | Correct | 719 ms | 632 KB | Output is correct |
20 | Correct | 723 ms | 548 KB | Output is correct |
21 | Correct | 533 ms | 548 KB | Output is correct |
22 | Correct | 473 ms | 632 KB | Output is correct |
23 | Correct | 217 ms | 632 KB | Output is correct |
24 | Correct | 435 ms | 636 KB | Output is correct |
25 | Correct | 181 ms | 568 KB | Output is correct |
26 | Correct | 223 ms | 572 KB | Output is correct |
27 | Correct | 457 ms | 632 KB | Output is correct |
28 | Correct | 465 ms | 632 KB | Output is correct |
29 | Correct | 38 ms | 504 KB | Output is correct |
30 | Correct | 294 ms | 604 KB | Output is correct |
31 | Correct | 257 ms | 604 KB | Output is correct |
32 | Correct | 275 ms | 504 KB | Output is correct |
33 | Correct | 444 ms | 540 KB | Output is correct |
34 | Correct | 414 ms | 632 KB | Output is correct |
35 | Correct | 491 ms | 660 KB | Output is correct |
36 | Correct | 481 ms | 636 KB | Output is correct |
37 | Correct | 476 ms | 632 KB | Output is correct |
38 | Correct | 480 ms | 628 KB | Output is correct |
39 | Correct | 478 ms | 632 KB | Output is correct |
40 | Correct | 976 ms | 2780 KB | Output is correct |
41 | Correct | 117 ms | 888 KB | Output is correct |
42 | Correct | 775 ms | 2936 KB | Output is correct |
43 | Correct | 744 ms | 2532 KB | Output is correct |
44 | Correct | 743 ms | 2680 KB | Output is correct |
45 | Correct | 1438 ms | 12176 KB | Output is correct |
46 | Correct | 128 ms | 2424 KB | Output is correct |
47 | Correct | 1124 ms | 12280 KB | Output is correct |
48 | Correct | 1022 ms | 10440 KB | Output is correct |
49 | Correct | 1018 ms | 11108 KB | Output is correct |