Submission #432703

# Submission time Handle Problem Language Result Execution time Memory
432703 2021-06-18T12:35:07 Z rainboy Archery (IOI09_archery) C
10 / 100
2000 ms 5968 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;
	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:12:3: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   12 |   scanf("%d", &aa[i]);
      |   ^~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
2 Execution timed out 2074 ms 204 KB Time limit exceeded
3 Incorrect 33 ms 204 KB Output isn't correct
4 Execution timed out 2081 ms 332 KB Time limit exceeded
5 Correct 1 ms 204 KB Output is correct
6 Correct 209 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 204 KB Output is correct
2 Incorrect 272 ms 248 KB Output isn't correct
3 Execution timed out 2073 ms 204 KB Time limit exceeded
4 Execution timed out 2044 ms 640 KB Time limit exceeded
5 Execution timed out 2082 ms 5076 KB Time limit exceeded
6 Incorrect 213 ms 288 KB Output isn't correct
7 Execution timed out 2083 ms 284 KB Time limit exceeded
8 Execution timed out 2073 ms 588 KB Time limit exceeded
9 Execution timed out 2045 ms 716 KB Time limit exceeded
10 Execution timed out 2076 ms 204 KB Time limit exceeded
11 Execution timed out 2050 ms 844 KB Time limit exceeded
12 Execution timed out 2096 ms 332 KB Time limit exceeded
13 Execution timed out 2076 ms 3684 KB Time limit exceeded
14 Execution timed out 2073 ms 332 KB Time limit exceeded
15 Execution timed out 2045 ms 1100 KB Time limit exceeded
16 Incorrect 256 ms 284 KB Output isn't correct
17 Execution timed out 2072 ms 204 KB Time limit exceeded
18 Execution timed out 2082 ms 204 KB Time limit exceeded
19 Execution timed out 2053 ms 412 KB Time limit exceeded
20 Execution timed out 2073 ms 332 KB Time limit exceeded
21 Execution timed out 2077 ms 844 KB Time limit exceeded
22 Execution timed out 2061 ms 964 KB Time limit exceeded
23 Execution timed out 2073 ms 5352 KB Time limit exceeded
24 Incorrect 262 ms 204 KB Output isn't correct
25 Execution timed out 2078 ms 204 KB Time limit exceeded
26 Execution timed out 2081 ms 332 KB Time limit exceeded
27 Execution timed out 2078 ms 844 KB Time limit exceeded
28 Execution timed out 2070 ms 3780 KB Time limit exceeded
29 Execution timed out 2061 ms 204 KB Time limit exceeded
30 Execution timed out 2077 ms 332 KB Time limit exceeded
31 Execution timed out 2025 ms 716 KB Time limit exceeded
32 Execution timed out 2079 ms 5188 KB Time limit exceeded
33 Correct 257 ms 268 KB Output is correct
34 Correct 228 ms 284 KB Output is correct
35 Execution timed out 2085 ms 204 KB Time limit exceeded
36 Execution timed out 2058 ms 332 KB Time limit exceeded
37 Execution timed out 2080 ms 716 KB Time limit exceeded
38 Execution timed out 2074 ms 844 KB Time limit exceeded
39 Correct 221 ms 272 KB Output is correct
40 Execution timed out 2073 ms 204 KB Time limit exceeded
41 Execution timed out 2087 ms 204 KB Time limit exceeded
42 Execution timed out 2079 ms 332 KB Time limit exceeded
43 Execution timed out 2057 ms 332 KB Time limit exceeded
44 Execution timed out 2080 ms 460 KB Time limit exceeded
45 Execution timed out 2079 ms 716 KB Time limit exceeded
46 Execution timed out 2085 ms 844 KB Time limit exceeded
47 Execution timed out 2056 ms 5968 KB Time limit exceeded