이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#include "xylophone.h"
#define ll long long
#define pb push_back
using namespace std;
const int N = 1e5 + 5;
int n, m, a[N], b[N], x[N];
void solve(int n)
{
//cout << "ok" << '\n';
for (int i = 2; i <= n; i++)
{
a[i] = query(i - 1, i);
}
b[2] = 1;
for (int i = 3; i <= n; i++)
{
if (a[i] + a[i - 1] == query(i - 2, i))
b[i] = b[i - 1];
else
b[i] = -b[i - 1];
}
int mx = 0, mn = 0, idn = 1, idx = 1;
for (int i = 2; i <= n; i++)
{
a[i] = a[i] * b[i] + a[i - 1];
if (a[i] > mx)
{
idx = i;
mx = a[i];
}
if (a[i] < mn)
{
idn = i;
mn = a[i];
}
//cout << a[i] << " ";
}
//cout << '\n';
//cout << idn << " " << idx << '\n';
if (idn < idx)
{
for (int i = 1; i <= n; i++)
a[i] += 1 - mn;
}
else
for (int i = 1; i <= n; i++)
a[i] = -a[i] + mn + n;
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... |