# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
965680 | Pring | Xylophone (JOI18_xylophone) | C++17 | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
#ifdef MIKU
string dbmc = "\033[1;38;2;57;197;187m", dbrs = "\033[0m";
#define debug(x...) cout << dbmc << "[" << #x << "]: ", dout(x)
void dout() { cout << dbrs << endl; }
template <typename T, typename ...U>
void dout(T t, U ...u) { cout << t << (sizeof...(u) ? ", " : ""); dout(u...); }
#else
#define debug(...) 39
#endif
#define fs first
#define sc second
#define mp make_pair
#define FOR(i, j, k) for (int i = j, Z = k; i < Z; i++)
using ll = long long;
typedef pair<int, int> pii;
namespace {
const int MXN = 10005;
int a[MXN], b[MXN];
int ans[MXN];
}
void solve(int n) {
FOR(i, 1, n) a[i] = query(i, i + 1);
FOR(i, 2, n) b[i] = query(i - 1, i + 1);
ans[1] = a[1];
bool p = 1;
FOR(i, 2, n) {
if (a[i - 1] + a[i] == b[i]) p *= -1;
ans[i] = ans[i - 1] + a[i] * p;
}
int sml = min_element(ans, ans + n) - ans, big = max_element(ans, ans + n) - ans;
if (sml > big) {
swap(sml, big);
FOR(i, 0, n) ans[i] *= -1;
}
int x = -a[sml];
FOR(i, 0, n) ans[i] += x + 1;
FOR(i, 0, n) answer(i + 1, ans[i]);
}
#ifdef MIKU
void miku() {
}
int32_t main() {
cin.tie(0) -> sync_with_stdio(false);
cin.exceptions(cin.failbit);
miku();
return 0;
}
#endif