# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
471736 | rainboy | Vođe (COCI17_vode) | C11 | 173 ms | 452 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 <stdio.h>
#include <string.h>
#define N 5000
#define M 5000
int main() {
static int cc[N], dp[N], dq[N], dp_[N], dq_[N];
int n, m, k, i, j;
scanf("%d%d%d", &n, &m, &k);
for (i = 0; i < n; i++)
scanf("%d", &cc[i]);
for (i = 0; i < n; i++)
dp[i] = cc[i] ^ 1, dq[i] = m;
for (j = m - 2; j >= 0; j--) {
for (i = 0; i < n; i++) {
dp_[i] = cc[i] ^ (dp[(i + 1) % n] == cc[i] || dq[(i + 1) % n] != m && dq[(i + 1) % n] - j <= k ? 0 : 1);
dq_[i] = dp_[i] == dp[i] ? dq[i] : j + 1;
}
memcpy(dp, dp_, n * sizeof *dp_);
memcpy(dq, dq_, n * sizeof *dq_);
}
for (i = 0; i < n; i++)
printf("%d ", dp[i]);
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... |
# | 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... |