Submission #549454

# Submission time Handle Problem Language Result Execution time Memory
549454 2022-04-15T20:19:44 Z rainboy 복사 붙여넣기 2 (JOI15_copypaste2) C
100 / 100
129 ms 8636 KB
#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

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 time Memory Grader output
1 Correct 0 ms 352 KB Output is correct
2 Correct 1 ms 308 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 308 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 352 KB Output is correct
2 Correct 1 ms 308 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 308 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 118 ms 8476 KB Output is correct
10 Correct 88 ms 8456 KB Output is correct
11 Correct 89 ms 8528 KB Output is correct
12 Correct 120 ms 8396 KB Output is correct
13 Correct 91 ms 8212 KB Output is correct
14 Correct 84 ms 8376 KB Output is correct
15 Correct 91 ms 8264 KB Output is correct
16 Correct 103 ms 8264 KB Output is correct
17 Correct 129 ms 8088 KB Output is correct
18 Correct 67 ms 8636 KB Output is correct
19 Correct 67 ms 8396 KB Output is correct
20 Correct 66 ms 8392 KB Output is correct
21 Correct 70 ms 8372 KB Output is correct
22 Correct 73 ms 8336 KB Output is correct
23 Correct 80 ms 8336 KB Output is correct
24 Correct 85 ms 8340 KB Output is correct
25 Correct 103 ms 8388 KB Output is correct
26 Correct 118 ms 8456 KB Output is correct