제출 #1349004

#제출 시각아이디문제언어결과실행 시간메모리
1349004tovnoimanjinXylophone (JOI18_xylophone)C++20
0 / 100
0 ms348 KiB
#include "xylophone.h"

static int A[5000];

void solve(int N) {

	int lo = 1, hi = N;
	int val = query(lo, hi);
	
	while (query(lo, hi) == val) {
		
		lo++;
		
	}
	
	lo--;
	
	while (query(lo, hi) == val) {
		
		hi--;
		
	}
	
	hi++;
	
	answer(lo, 1);
	answer(hi, N);
	
	for (int i = 1; i < lo; i++) {
		
		int c = query(i, lo);
		
		answer(i, c + 1);
		
		
	}
	
	for (int i = lo + 1; i < hi; i++) {
		
		int c = query(i, hi);
		answer(i, N - c);
		
	}
	
	for (int i = hi + 1; i <= N; i++) {
		
		int c = query(i, hi);
		answer(i, N - c);
		
	}
	
	return;

}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...