Submission #95995

# Submission time Handle Problem Language Result Execution time Memory
95995 2019-02-05T03:07:39 Z diamond_duke Xylophone (JOI18_xylophone) C++11
0 / 100
2 ms 404 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 = 0; i < n - 1; 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);
}
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 404 KB Wrong Answer [4]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 404 KB Wrong Answer [4]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 404 KB Wrong Answer [4]
2 Halted 0 ms 0 KB -