# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
719206 | stevancv | Lottery (CEOI18_lot) | C++14 | 476 ms | 8304 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>
#define ll long long
#define ld long double
#define sp ' '
#define en '\n'
#define smin(a, b) a = min(a, b)
#define smax(a, b) a = max(a, b)
using namespace std;
const int N = 1e4 + 2;
const int M = 100 + 2;
const int inf = 1e9;
int a[N], b[M], dp[2][N], ans[M][N], cnt[N], n, l, q, m;
void Solve(int j) {
int t = j & 1;
for (int i = 0; i <= l; i++) cnt[i] = 0;
for (int i = 0; i < m; i++) if (i != j) cnt[dp[t][i]]++;
for (int i = 1; i <= l; i++) cnt[i] += cnt[i - 1];
for (int i = 0; i < q; i++) ans[i][j] = cnt[b[i]];
}
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cin >> n >> l;
m = n - l + 1;
for (int i = 0; i < n; i++) cin >> a[i];
cin >> q;
for (int i = 0; i < q; i++) cin >> b[i];
for (int i = 0; i < m; i++) for (int j = 0; j < l; j++) dp[0][i] += a[j] != a[i + j];
Solve(0);
# | 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... |