# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
198601 | ZwariowanyMarcin | Vođe (COCI17_vode) | C++14 | 239 ms | 504 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 fi first
#define se second
#define mp make_pair
#define ss(x) (int) x.size()
#define pb push_back
#define LL long long
#define ld long double
#define cat(x) cerr << #x << " = " << x << endl
#define FOR(i, j, n) for(int i = j; i <= n; ++i)
#define boost cin.tie(0), ios_base::sync_with_stdio(0);
using namespace std;
const int nax = 5010;
const int INF = 1e9 + 111;
int n, m, k;
int a[nax];
int win[nax];
int lose[nax];
int dp[nax];
int main() {
scanf ("%d%d%d", &n, &m, &k);
for (int i = 0; i < n; ++i) {
scanf ("%d", a + i);
win[i] = INF;
lose[i] = m - 1;
}
for (int i = m - 2; 0 <= i; --i) {
for (int j = 0; j < n; ++j) {
int g = (j + 1) % n;
if (a[j] == a[g]) {
if (win[g] <= i + k) {
dp[j] = 1;
}
else {
dp[j] = 0;
}
}
else {
if (lose[g] <= i + k) {
dp[j] = 1;
}
else {
dp[j] = 0;
}
}
}
for (int j = 0; j < n; ++j) {
if (dp[j]) win[j] = i;
else lose[j] = i;
}
}
for (int i = 0; i < n; ++i) {
if ((a[i] == 0 && dp[i] == 1) || (a[i] == 1 && dp[i] == 0))
printf ("0 ");
else
printf ("1 ");
}
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... |