# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
760918 | MilosMilutinovic | Lottery (CEOI18_lot) | C++14 | 72 ms | 65536 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
const int N = 1e4 + 10;
int n, d, q, a[N], f[N][N];
int main() {
scanf("%d%d", &n, &d);
for (int i = 1; i <= n; i++) {
scanf("%d", &a[i]);
}
for (int l = 1; l + d - 1 <= n; l++) {
int cnt = 0;
for (int i = 1; i <= d; i++)
cnt += (a[i] != a[l + i - 1]);
for (int r = 1; l + (d - 1) + (r - 1) <= n; r++) {
f[r][l + r - 1] = cnt;
f[l + r - 1][r] = cnt;
cnt -= (a[l + r - 1] != a[r]);
cnt += (a[l + r + d - 1] != a[r + d]);
}
}
// for (int i = 1; i + d - 1 <= n; i++)
// for (int j = i + 1; j + d - 1 <= n; j++)
// printf("i = %d, j = %d diff = %d\n", i, j, f[i][j]);
scanf("%d", &q);
while (q--) {
int k;
scanf("%d", &k);
for (int i = 1; i + d - 1 <= n; i++) {
int cnt = 0;
for (int j = 1; j + d - 1 <= n; j++)
cnt += (f[i][j] <= k);
printf("%d ", cnt - 1);
}
printf("\n");
}
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |