이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "xylophone.h"
#include "bits/stdc++.h"
using namespace std;
int my_query(int l, int r, vector <int> &a) {
int mx = -1e9, mn = 1e9;
for (int i = l; i <= r; ++i) {
mx = max(mx, a[i]);
mn = min(mn, a[i]);
}
return mx - mn;
}
void solve(int n) {
vector <int> a(n + 1);
a[1] = 0;
a[2] = query(1, 2);
for (int i = 3; i <= n; ++i) {
int x = query(i - 2, i);
int y = query(i - 1, i);
for (int z = -n; z <= n; ++z) {
a[i] = z;
if (my_query(i - 2, i, a) == x && my_query(i - 1, i, a) == y) {
break;
}
}
}
int mn = 1e9;
for (int i = 1; i <= n; ++i) mn = min(mn, a[i]);
for (int i = 1; i <= n; ++i) a[i] -= mn - 1;
bool fl = false;
for (int i = 1; i <= n; ++i) {
for (int j = 1; j <= n; ++j) {
if (a[i] == 1 && a[j] == n) {
if (i > j) {
fl = true;
}
}
}
}
if (fl) {
for (int i = 1; i <= n; ++i) {
a[i] = n - a[i] + 1;
}
}
for (int i = 1; i <= n; ++i) {
answer(i, a[i]);
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |