# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
945371 | rainboy | Take-out (POI13_usu) | C11 | 98 ms | 20872 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>
#define N 1000000
int main() {
static char cc[N + 1];
static int pp[N + 1], qu[N], ii[N];
int n, m, k, cnt, h, i;
scanf("%d%d%s", &n, &k, cc);
m = 0, cnt = 0;
for (i = 0; i < n; i++) {
if (cc[i] == 'c')
pp[m + 1] = pp[m] + k, qu[m] = i, m++;
else
pp[m + 1] = pp[m] - 1, qu[m] = i, m++;
if (m >= k + 1 && pp[m] == pp[m - k - 1]) {
for (h = m - k - 1; h < m; h++)
ii[cnt++] = qu[h];
m -= k + 1;
}
}
for (h = n / (k + 1) - 1; h >= 0; h--) {
for (i = h * (k + 1); i < (h + 1) * (k + 1); i++)
printf("%d ", ii[i] + 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... |
# | 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... |