답안 #432705

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
432705 2021-06-18T12:36:56 Z rainboy Archery (IOI09_archery) C
10 / 100
269 ms 272 KB
#include <stdio.h>
#include <string.h>

#define N	200000

int main() {
	static int aa[N * 2], bb[N * 2];
	int n, r, h, h_, i, i_, j;

	scanf("%d%d", &n, &r), r = (r - n * 2) % n + n * 2;
	if (n > 200) {
		printf(":(\n");
		return 0;
	}
	for (i = 0; i < n * 2; i++)
		scanf("%d", &aa[i]);
	i_ = -1, h_ = n * 2;
	for (i = 0; i < n * 2; i++) {
		int tmp;

		if (i > 0)
			tmp = aa[i], aa[i] = aa[i - 1], aa[i - 1] = tmp;
		memcpy(bb, aa, n * 2 * sizeof *aa);
		for (j = 0; j < r; j++) {
			for (h = 0; h < n * 2; h += 2)
				if (bb[h] > bb[h + 1])
					tmp = bb[h], bb[h] = bb[h + 1], bb[h + 1] = tmp;
			for (h = 2; h < n * 2; h++)
				tmp = bb[h], bb[h] = bb[h - 1], bb[h - 1] = tmp;
		}
		for (h = 0; h < n * 2; h++)
			if (bb[h] == aa[i])
				break;
		if (h_ > h)
			h_ = h, i_ = i / 2;
	}
	printf("%d\n", i_ + 1);
	return 0;
}

Compilation message

archery.c: In function 'main':
archery.c:10:2: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   10 |  scanf("%d%d", &n, &r), r = (r - n * 2) % n + n * 2;
      |  ^~~~~~~~~~~~~~~~~~~~~
archery.c:16:3: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   16 |   scanf("%d", &aa[i]);
      |   ^~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
2 Incorrect 0 ms 204 KB Output isn't correct
3 Incorrect 32 ms 204 KB Output isn't correct
4 Incorrect 0 ms 204 KB Output isn't correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 217 ms 272 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 204 KB Output is correct
2 Incorrect 267 ms 204 KB Output isn't correct
3 Incorrect 0 ms 204 KB Output isn't correct
4 Incorrect 0 ms 204 KB Output isn't correct
5 Incorrect 0 ms 204 KB Output isn't correct
6 Incorrect 216 ms 272 KB Output isn't correct
7 Incorrect 0 ms 204 KB Output isn't correct
8 Incorrect 0 ms 204 KB Output isn't correct
9 Incorrect 0 ms 204 KB Output isn't correct
10 Incorrect 0 ms 204 KB Output isn't correct
11 Incorrect 0 ms 204 KB Output isn't correct
12 Incorrect 0 ms 204 KB Output isn't correct
13 Incorrect 0 ms 204 KB Output isn't correct
14 Incorrect 0 ms 204 KB Output isn't correct
15 Incorrect 0 ms 204 KB Output isn't correct
16 Incorrect 258 ms 264 KB Output isn't correct
17 Incorrect 0 ms 204 KB Output isn't correct
18 Incorrect 0 ms 204 KB Output isn't correct
19 Incorrect 1 ms 236 KB Output isn't correct
20 Incorrect 0 ms 204 KB Output isn't correct
21 Incorrect 1 ms 204 KB Output isn't correct
22 Incorrect 0 ms 204 KB Output isn't correct
23 Incorrect 0 ms 204 KB Output isn't correct
24 Incorrect 261 ms 264 KB Output isn't correct
25 Incorrect 0 ms 204 KB Output isn't correct
26 Incorrect 1 ms 204 KB Output isn't correct
27 Incorrect 0 ms 204 KB Output isn't correct
28 Incorrect 1 ms 204 KB Output isn't correct
29 Incorrect 0 ms 204 KB Output isn't correct
30 Incorrect 0 ms 204 KB Output isn't correct
31 Incorrect 0 ms 204 KB Output isn't correct
32 Incorrect 0 ms 204 KB Output isn't correct
33 Correct 269 ms 272 KB Output is correct
34 Correct 228 ms 268 KB Output is correct
35 Incorrect 0 ms 204 KB Output isn't correct
36 Incorrect 0 ms 204 KB Output isn't correct
37 Incorrect 0 ms 204 KB Output isn't correct
38 Incorrect 1 ms 204 KB Output isn't correct
39 Correct 217 ms 268 KB Output is correct
40 Incorrect 0 ms 204 KB Output isn't correct
41 Incorrect 0 ms 204 KB Output isn't correct
42 Incorrect 1 ms 204 KB Output isn't correct
43 Incorrect 1 ms 204 KB Output isn't correct
44 Incorrect 1 ms 204 KB Output isn't correct
45 Incorrect 1 ms 204 KB Output isn't correct
46 Incorrect 0 ms 204 KB Output isn't correct
47 Incorrect 0 ms 204 KB Output isn't correct