답안 #1032186

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1032186 2024-07-23T12:59:51 Z juicy Xylophone (JOI18_xylophone) C++17
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>

using namespace std;

#ifdef LOCAL
#include "debug.h"
#else
#define debug(...) 42
#endif

void solve(int N) {
	vector<int> A(N), qry(N);
	A[1] = qry[1] = query(1, 2);
	for (int i = 2; i < N; ++i) {
		qry[i] = query(i, i + 1);
		int a = A[i - 2], b = A[i - 1], &c = A[i];
		int AB = qry[i - 1], BC = qry[i], AC = query(i - 1, i + 1);
		if (AB == AC) {
			if (a < b) {
				c = b - BC;
			} else {
				c = b + BC;
			}
		} else if (BC == AC) {
			if (a < b) {
				c = b - BC;
			} else {
				c = b + BC;
			}
		} else {
			if (a < b) {
				c = b + BC;
			} else {
				c = b - BC;
			}
		}
	}
	vector<int> ord(N); iota(ord.begin(), ord.end(), 0);
	sort(ord.begin(), ord.end(), [&](int u, int v) {
		return A[u] < A[v];
	});
	if (ord[0] > ord.back()) {
		reverse(ord.begin(), ord.end());
	}
	for (int i = 0; i < N; ++i) {
		answer(ord[i] + 1, i + 1);
	}
}

Compilation message

xylophone.cpp: In function 'void solve(int)':
xylophone.cpp:13:18: error: 'query' was not declared in this scope; did you mean 'qry'?
   13 |  A[1] = qry[1] = query(1, 2);
      |                  ^~~~~
      |                  qry
xylophone.cpp:46:3: error: 'answer' was not declared in this scope
   46 |   answer(ord[i] + 1, i + 1);
      |   ^~~~~~