Submission #432706

# Submission time Handle Problem Language Result Execution time Memory
432706 2021-06-18T12:38:41 Z rainboy Archery (IOI09_archery) C
20 / 100
277 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]) {
				h /= 2;
				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]);
      |   ^~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Incorrect 1 ms 204 KB Output isn't correct
3 Correct 33 ms 204 KB Output is correct
4 Incorrect 1 ms 204 KB Output isn't correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 208 ms 268 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 204 KB Output is correct
2 Correct 277 ms 204 KB Output is correct
3 Incorrect 1 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 Correct 214 ms 264 KB Output is 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 1 ms 204 KB Output isn't correct
12 Incorrect 1 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 1 ms 204 KB Output isn't correct
16 Correct 260 ms 204 KB Output is 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 204 KB Output isn't correct
20 Incorrect 0 ms 204 KB Output isn't correct
21 Incorrect 0 ms 204 KB Output isn't correct
22 Incorrect 1 ms 204 KB Output isn't correct
23 Incorrect 1 ms 204 KB Output isn't correct
24 Correct 274 ms 268 KB Output is correct
25 Incorrect 0 ms 204 KB Output isn't correct
26 Incorrect 1 ms 204 KB Output isn't correct
27 Incorrect 1 ms 204 KB Output isn't correct
28 Incorrect 1 ms 204 KB Output isn't correct
29 Incorrect 1 ms 204 KB Output isn't correct
30 Incorrect 0 ms 204 KB Output isn't correct
31 Incorrect 1 ms 204 KB Output isn't correct
32 Incorrect 0 ms 204 KB Output isn't correct
33 Correct 257 ms 268 KB Output is correct
34 Correct 230 ms 204 KB Output is correct
35 Incorrect 1 ms 204 KB Output isn't correct
36 Incorrect 1 ms 204 KB Output isn't correct
37 Incorrect 0 ms 204 KB Output isn't correct
38 Incorrect 0 ms 204 KB Output isn't correct
39 Correct 214 ms 272 KB Output is correct
40 Incorrect 1 ms 204 KB Output isn't correct
41 Incorrect 1 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 0 ms 204 KB Output isn't correct
45 Incorrect 0 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