Submission #930926

# Submission time Handle Problem Language Result Execution time Memory
930926 2024-02-20T20:06:22 Z rainboy 카드 역배치 (KOI15_reversal) C
25 / 25
0 ms 420 KB
#include <stdio.h>

#define N	20
#define Q	10

int main() {
	static int aa[N];
	int h, i, l, r, tmp;

	for (i = 0; i < N; i++)
		aa[i] = i + 1;
	for (h = 0; h < Q; h++) {
		scanf("%d%d", &l, &r), l--, r--;
		while (l < r) {
			tmp = aa[l], aa[l] = aa[r], aa[r] = tmp;
			l++, r--;
		}
	}
	for (i = 0; i < N; i++)
		printf("%d ", aa[i]);
	printf("\n");
	return 0;
}

Compilation message

reversal.c: In function 'main':
reversal.c:13:3: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   13 |   scanf("%d%d", &l, &r), l--, r--;
      |   ^~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 420 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 0 ms 348 KB Output is correct