Submission #549454

#TimeUsernameProblemLanguageResultExecution timeMemory
549454rainboy복사 붙여넣기 2 (JOI15_copypaste2)C11
100 / 100
129 ms8636 KiB
#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)

copypaste2.c: In function 'main':
copypaste2.c:12:2: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   12 |  scanf("%d%*d%s%d", &n, aa, &q);
      |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
copypaste2.c:14:3: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   14 |   scanf("%d%d%d", &ll[h], &rr[h], &pp[h]);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...