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;
typedef long long ll;
typedef pair< int, int > ii;
typedef pair< int, ii > iii;
typedef vector< int > vi;
typedef vector< ii > vii;
typedef vector< iii > viii;
typedef vector< vi > vvi;
typedef vector< vii > vvii;
typedef vector< viii > vviii;
#define hdp 1e9+7
#define MAX LLONG_MAX
#define st first
#define nd second
const int N = 5005;
int a[N];
void solve(int n){
a[2] = query(1, 2);
for(int i=3; i<=n; i++){
int x = query(i-1, i);
int y = query(i-2, i);
if((y == x and a[i-2] > a[i-1]) or (y != x and a[i-1] > a[i-2]))
a[i] = a[i-1] + x;
else
a[i] = a[i-1] - x;
}
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... |