답안 #95996

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
95996 2019-02-05T03:15:09 Z diamond_duke Xylophone (JOI18_xylophone) C++11
100 / 100
113 ms 528 KB
#include "xylophone.h"
int arr[5005], adj[5005], three[5005];
void solve(int n)
{
	for (int i = 1; i < n; i++)
		adj[i] = query(i, i + 1);
	for (int i = 2; i < n; i++)
		three[i] = query(i - 1, i + 1);
	arr[0] = 0;
	arr[1] = adj[1];
	for (int i = 2, dir = 1; i < n; i++)
	{
		if (three[i] != adj[i - 1] + adj[i])
			dir ^= 1;
		arr[i] = arr[i - 1] + adj[i] * (dir * 2 - 1);
	}
	int mnp = 0, mxp = 0;
	for (int i = 1; i < n; i++)
	{
		if (arr[i] < arr[mnp])
			mnp = i;
		if (arr[i] > arr[mxp])
			mxp = i;
	}
	for (int i = 0; i < n; i++)
		answer(i + 1, mnp < mxp ? arr[i] - arr[mnp] + 1 : arr[mxp] - arr[i] + 1);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 248 KB Output is correct
3 Correct 2 ms 248 KB Output is correct
4 Correct 3 ms 376 KB Output is correct
5 Correct 2 ms 248 KB Output is correct
6 Correct 3 ms 248 KB Output is correct
7 Correct 4 ms 376 KB Output is correct
8 Correct 3 ms 376 KB Output is correct
9 Correct 4 ms 248 KB Output is correct
10 Correct 3 ms 376 KB Output is correct
11 Correct 3 ms 248 KB Output is correct
12 Correct 2 ms 296 KB Output is correct
13 Correct 4 ms 376 KB Output is correct
14 Correct 4 ms 376 KB Output is correct
15 Correct 3 ms 304 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 248 KB Output is correct
3 Correct 2 ms 248 KB Output is correct
4 Correct 3 ms 376 KB Output is correct
5 Correct 2 ms 248 KB Output is correct
6 Correct 3 ms 248 KB Output is correct
7 Correct 4 ms 376 KB Output is correct
8 Correct 3 ms 376 KB Output is correct
9 Correct 4 ms 248 KB Output is correct
10 Correct 3 ms 376 KB Output is correct
11 Correct 3 ms 248 KB Output is correct
12 Correct 2 ms 296 KB Output is correct
13 Correct 4 ms 376 KB Output is correct
14 Correct 4 ms 376 KB Output is correct
15 Correct 3 ms 304 KB Output is correct
16 Correct 6 ms 376 KB Output is correct
17 Correct 13 ms 312 KB Output is correct
18 Correct 18 ms 248 KB Output is correct
19 Correct 23 ms 376 KB Output is correct
20 Correct 20 ms 248 KB Output is correct
21 Correct 18 ms 248 KB Output is correct
22 Correct 23 ms 316 KB Output is correct
23 Correct 23 ms 376 KB Output is correct
24 Correct 9 ms 504 KB Output is correct
25 Correct 9 ms 380 KB Output is correct
26 Correct 8 ms 296 KB Output is correct
27 Correct 18 ms 376 KB Output is correct
28 Correct 21 ms 380 KB Output is correct
29 Correct 21 ms 312 KB Output is correct
30 Correct 17 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 248 KB Output is correct
3 Correct 2 ms 248 KB Output is correct
4 Correct 3 ms 376 KB Output is correct
5 Correct 2 ms 248 KB Output is correct
6 Correct 3 ms 248 KB Output is correct
7 Correct 4 ms 376 KB Output is correct
8 Correct 3 ms 376 KB Output is correct
9 Correct 4 ms 248 KB Output is correct
10 Correct 3 ms 376 KB Output is correct
11 Correct 3 ms 248 KB Output is correct
12 Correct 2 ms 296 KB Output is correct
13 Correct 4 ms 376 KB Output is correct
14 Correct 4 ms 376 KB Output is correct
15 Correct 3 ms 304 KB Output is correct
16 Correct 6 ms 376 KB Output is correct
17 Correct 13 ms 312 KB Output is correct
18 Correct 18 ms 248 KB Output is correct
19 Correct 23 ms 376 KB Output is correct
20 Correct 20 ms 248 KB Output is correct
21 Correct 18 ms 248 KB Output is correct
22 Correct 23 ms 316 KB Output is correct
23 Correct 23 ms 376 KB Output is correct
24 Correct 9 ms 504 KB Output is correct
25 Correct 9 ms 380 KB Output is correct
26 Correct 8 ms 296 KB Output is correct
27 Correct 18 ms 376 KB Output is correct
28 Correct 21 ms 380 KB Output is correct
29 Correct 21 ms 312 KB Output is correct
30 Correct 17 ms 376 KB Output is correct
31 Correct 49 ms 248 KB Output is correct
32 Correct 21 ms 300 KB Output is correct
33 Correct 78 ms 324 KB Output is correct
34 Correct 86 ms 376 KB Output is correct
35 Correct 81 ms 316 KB Output is correct
36 Correct 84 ms 376 KB Output is correct
37 Correct 82 ms 376 KB Output is correct
38 Correct 86 ms 248 KB Output is correct
39 Correct 83 ms 376 KB Output is correct
40 Correct 77 ms 376 KB Output is correct
41 Correct 113 ms 380 KB Output is correct
42 Correct 74 ms 456 KB Output is correct
43 Correct 86 ms 376 KB Output is correct
44 Correct 78 ms 376 KB Output is correct
45 Correct 92 ms 316 KB Output is correct
46 Correct 103 ms 308 KB Output is correct
47 Correct 81 ms 404 KB Output is correct
48 Correct 104 ms 376 KB Output is correct
49 Correct 83 ms 376 KB Output is correct
50 Correct 89 ms 316 KB Output is correct
51 Correct 34 ms 300 KB Output is correct
52 Correct 80 ms 248 KB Output is correct
53 Correct 83 ms 528 KB Output is correct
54 Correct 79 ms 376 KB Output is correct
55 Correct 87 ms 316 KB Output is correct
56 Correct 92 ms 376 KB Output is correct
57 Correct 93 ms 320 KB Output is correct
58 Correct 84 ms 248 KB Output is correct
59 Correct 33 ms 300 KB Output is correct
60 Correct 81 ms 248 KB Output is correct