# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
549454 | rainboy | 복사 붙여넣기 2 (JOI15_copypaste2) | C11 | 129 ms | 8636 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 200000
#define N_ 200
#define Q 200000
int main() {
static char aa[N + 1], bb[N_ + 1];
static int ll[Q], rr[Q], pp[Q], ii[N_];
int n, q, h, i;
scanf("%d%*d%s%d", &n, aa, &q);
for (h = 0; h < q; h++)
scanf("%d%d%d", &ll[h], &rr[h], &pp[h]);
for (i = 0; i < n; i++)
ii[i] = i;
for (h = q - 1; h >= 0; h--)
for (i = 0; i < n; i++)
if (ii[i] >= pp[h] + rr[h] - ll[h])
ii[i] -= rr[h] - ll[h];
else if (ii[i] >= pp[h])
ii[i] += ll[h] - pp[h];
for (i = 0; i < n; i++)
bb[i] = aa[ii[i]];
printf("%s\n", bb);
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |