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>
#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... |