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 "xylophone.h"
#include <bits/stdc++.h>
using namespace std;
const int N = 5005;
static int a[N];
void solve(int n){
a[2] = query(1, 2);
for(int i = 3, x, y; i <= n; i++){
x = query(i - 2, i);
y = query(i - 1, i);
if((x == y + abs(a[i - 2] - a[i - 1])) ^ (a[i - 2] > a[i - 1]))
a[i] = a[i - 1] + y;
else a[i] = a[i - 1] - y;
}
if(min_element(a + 1, a + n + 1) > max_element(a + 1, a + n + 1))
for(int i = 1; i <= n; i++) a[i] *= -1;
int m = *min_element(a + 1, a + n + 1);
for(int i = 1; i <= n; i++) answer(i, a[i] - m + 1);
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |