답안 #130613

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
130613 2019-07-15T18:03:49 Z tutis Xylophone (JOI18_xylophone) C++17
0 / 100
3 ms 376 KB
#include <bits/stdc++.h>
#pragma GCC optimize ("O3")
#include "xylophone.h"
using namespace std;
void solve(int N)
{
	int A[N + 1];
	A[1] = 0;
	A[2] = A[1] + query(1, 2);
	for (int i = 3; i <= N; i++)
	{
		int x = query(i - 1, i);
		int y = query(i - 2, i);
		if (A[i - 1] > A[i - 2])
		{
			if (y == x + A[i - 1] - A[i - 2])
				A[i] = A[i - 1] + x;
			else
				A[i] = A[i - 1] - x;
		}
		else
		{
			if (y == x + A[i - 2] - A[i - 1])
				A[i] = A[i - 1] - x;
			else
				A[i] = A[i - 1] + x;
		}
	}
	auto it1 = min_element(A + 1, A + (N + 1));
	auto itn = max_element(A + 1, A + (N + 1));
	if (it1 > itn)
	{
		reverse(A + 1, A + (N + 1));
	}
	int x = *min_element(A, A + (N + 1));
	for (int i = 1; i <= N; i++)
	{
		A[i] -= x;
		A[i]++;
		answer(i, A[i]);
	}
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 296 KB Output is correct
2 Correct 2 ms 252 KB Output is correct
3 Correct 3 ms 376 KB Output is correct
4 Correct 3 ms 244 KB Output is correct
5 Incorrect 3 ms 248 KB Wrong Answer [7]
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 296 KB Output is correct
2 Correct 2 ms 252 KB Output is correct
3 Correct 3 ms 376 KB Output is correct
4 Correct 3 ms 244 KB Output is correct
5 Incorrect 3 ms 248 KB Wrong Answer [7]
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 296 KB Output is correct
2 Correct 2 ms 252 KB Output is correct
3 Correct 3 ms 376 KB Output is correct
4 Correct 3 ms 244 KB Output is correct
5 Incorrect 3 ms 248 KB Wrong Answer [7]
6 Halted 0 ms 0 KB -