# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
883592 |
2023-12-05T13:25:59 Z |
tsumondai |
Lottery (CEOI18_lot) |
C++14 |
|
299 ms |
8276 KB |
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define foru(i, l, r) for(int i = l; i <= r; i++)
#define ford(i, r, l) for(int i = r; i >= l; i--)
#define __TIME (1.0 * clock() / CLOCKS_PER_SEC)
typedef pair<int, int> ii;
typedef pair<ii, int> iii;
typedef pair<ii, ii> iiii;
const int N = 1e4 + 5;
const int oo = 1e9, mod = 1e9 + 7;
int n, l, a[N], ps[N + 1], ans[N][100 + 1], b[N + 1], q, k[100], k2[100 + 1];
void process() {
cin >> n >> l;
foru(i, 0, n - 1) cin >> a[i];
cin >> q;
foru(i, 0, q - 1) cin >> k[i], k2[i] = k[i];
sort(k2, k2 + q);
k2[q] = l;
for (int i = 0, p = -1; i <= q; ++i) {
foru(j, p + 1, k2[i]) b[j] = i;
p = k2[i];
}
foru(i, 1, n - l) {
foru(j, 0, n - i - 1) ps[j + 1] = ps[j] + (a[j] != a[i + j]);
foru(j, 0, n - i - l) {
++ans[j][b[ps[j + l] - ps[j]]];
++ans[j + i][b[ps[j + l] - ps[j]]];
}
}
foru(i, 0, n - l) for (int j = 0; j < q - 1; ++j) ans[i][j + 1] += ans[i][j];
foru(i, 0, q - 1) {
foru(j, 0, n - l) cout << ans[j][lower_bound(k2, k2 + q, k[i]) - k2] << " ";
cout << "\n";
}
return;
}
signed main() {
cin.tie(0)->sync_with_stdio(false);
//freopen(".inp", "r", stdin);
//freopen(".out", "w", stdout);
process();
cerr << "Time elapsed: " << __TIME << " s.\n";
return 0;
}
// dont stop
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
468 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
344 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
1 ms |
348 KB |
Output is correct |
9 |
Correct |
1 ms |
348 KB |
Output is correct |
10 |
Correct |
1 ms |
600 KB |
Output is correct |
11 |
Correct |
2 ms |
604 KB |
Output is correct |
12 |
Correct |
1 ms |
604 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
468 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
344 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
1 ms |
348 KB |
Output is correct |
9 |
Correct |
1 ms |
348 KB |
Output is correct |
10 |
Correct |
1 ms |
600 KB |
Output is correct |
11 |
Correct |
2 ms |
604 KB |
Output is correct |
12 |
Correct |
1 ms |
604 KB |
Output is correct |
13 |
Correct |
8 ms |
2808 KB |
Output is correct |
14 |
Correct |
6 ms |
2648 KB |
Output is correct |
15 |
Correct |
5 ms |
2652 KB |
Output is correct |
16 |
Correct |
9 ms |
2704 KB |
Output is correct |
17 |
Correct |
8 ms |
2704 KB |
Output is correct |
18 |
Correct |
8 ms |
2648 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
213 ms |
4504 KB |
Output is correct |
2 |
Correct |
205 ms |
4492 KB |
Output is correct |
3 |
Correct |
201 ms |
4496 KB |
Output is correct |
4 |
Correct |
200 ms |
4488 KB |
Output is correct |
5 |
Correct |
62 ms |
2848 KB |
Output is correct |
6 |
Correct |
183 ms |
4184 KB |
Output is correct |
7 |
Correct |
61 ms |
2844 KB |
Output is correct |
8 |
Correct |
108 ms |
3416 KB |
Output is correct |
9 |
Correct |
224 ms |
4440 KB |
Output is correct |
10 |
Correct |
191 ms |
4440 KB |
Output is correct |
11 |
Correct |
9 ms |
2648 KB |
Output is correct |
12 |
Correct |
101 ms |
3160 KB |
Output is correct |
13 |
Correct |
87 ms |
2968 KB |
Output is correct |
14 |
Correct |
89 ms |
2904 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
213 ms |
4504 KB |
Output is correct |
2 |
Correct |
205 ms |
4492 KB |
Output is correct |
3 |
Correct |
201 ms |
4496 KB |
Output is correct |
4 |
Correct |
200 ms |
4488 KB |
Output is correct |
5 |
Correct |
62 ms |
2848 KB |
Output is correct |
6 |
Correct |
183 ms |
4184 KB |
Output is correct |
7 |
Correct |
61 ms |
2844 KB |
Output is correct |
8 |
Correct |
108 ms |
3416 KB |
Output is correct |
9 |
Correct |
224 ms |
4440 KB |
Output is correct |
10 |
Correct |
191 ms |
4440 KB |
Output is correct |
11 |
Correct |
9 ms |
2648 KB |
Output is correct |
12 |
Correct |
101 ms |
3160 KB |
Output is correct |
13 |
Correct |
87 ms |
2968 KB |
Output is correct |
14 |
Correct |
89 ms |
2904 KB |
Output is correct |
15 |
Correct |
213 ms |
4184 KB |
Output is correct |
16 |
Correct |
175 ms |
4432 KB |
Output is correct |
17 |
Correct |
203 ms |
4440 KB |
Output is correct |
18 |
Correct |
218 ms |
4528 KB |
Output is correct |
19 |
Correct |
220 ms |
4528 KB |
Output is correct |
20 |
Correct |
236 ms |
4528 KB |
Output is correct |
21 |
Correct |
205 ms |
4532 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
468 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
344 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
1 ms |
348 KB |
Output is correct |
9 |
Correct |
1 ms |
348 KB |
Output is correct |
10 |
Correct |
1 ms |
600 KB |
Output is correct |
11 |
Correct |
2 ms |
604 KB |
Output is correct |
12 |
Correct |
1 ms |
604 KB |
Output is correct |
13 |
Correct |
8 ms |
2808 KB |
Output is correct |
14 |
Correct |
6 ms |
2648 KB |
Output is correct |
15 |
Correct |
5 ms |
2652 KB |
Output is correct |
16 |
Correct |
9 ms |
2704 KB |
Output is correct |
17 |
Correct |
8 ms |
2704 KB |
Output is correct |
18 |
Correct |
8 ms |
2648 KB |
Output is correct |
19 |
Correct |
213 ms |
4504 KB |
Output is correct |
20 |
Correct |
205 ms |
4492 KB |
Output is correct |
21 |
Correct |
201 ms |
4496 KB |
Output is correct |
22 |
Correct |
200 ms |
4488 KB |
Output is correct |
23 |
Correct |
62 ms |
2848 KB |
Output is correct |
24 |
Correct |
183 ms |
4184 KB |
Output is correct |
25 |
Correct |
61 ms |
2844 KB |
Output is correct |
26 |
Correct |
108 ms |
3416 KB |
Output is correct |
27 |
Correct |
224 ms |
4440 KB |
Output is correct |
28 |
Correct |
191 ms |
4440 KB |
Output is correct |
29 |
Correct |
9 ms |
2648 KB |
Output is correct |
30 |
Correct |
101 ms |
3160 KB |
Output is correct |
31 |
Correct |
87 ms |
2968 KB |
Output is correct |
32 |
Correct |
89 ms |
2904 KB |
Output is correct |
33 |
Correct |
213 ms |
4184 KB |
Output is correct |
34 |
Correct |
175 ms |
4432 KB |
Output is correct |
35 |
Correct |
203 ms |
4440 KB |
Output is correct |
36 |
Correct |
218 ms |
4528 KB |
Output is correct |
37 |
Correct |
220 ms |
4528 KB |
Output is correct |
38 |
Correct |
236 ms |
4528 KB |
Output is correct |
39 |
Correct |
205 ms |
4532 KB |
Output is correct |
40 |
Correct |
220 ms |
5232 KB |
Output is correct |
41 |
Correct |
11 ms |
2904 KB |
Output is correct |
42 |
Correct |
218 ms |
5240 KB |
Output is correct |
43 |
Correct |
206 ms |
4656 KB |
Output is correct |
44 |
Correct |
207 ms |
4908 KB |
Output is correct |
45 |
Correct |
299 ms |
8276 KB |
Output is correct |
46 |
Correct |
17 ms |
3128 KB |
Output is correct |
47 |
Correct |
276 ms |
8276 KB |
Output is correct |
48 |
Correct |
249 ms |
6580 KB |
Output is correct |
49 |
Correct |
245 ms |
6996 KB |
Output is correct |