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>
#define ll long long
#define ld long double
#define pll pair<ll,ll>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
using namespace std;
const ll maxn = 5005;
ll T[maxn];
ll n;
ll Min = 1, Max = 2;
void solve(int x)
{
n = x;
T[1] = 0;
T[2] = query(1,2);
ll ptr = 1;
ll cur = T[2];
for(int i = 3; i<= n; i++)
{
ll value = query(min(Min, Max), i);
ll value2 = query(max(Min, Max), i);
if(value==abs(T[Min]-T[Max]))
{
if(Min>Max) T[i] = value2+T[Min];
else T[i] = T[Max]-value2;
}
else
{
if(Min>Max)
{
T[i] = T[Min]-value2;
Min = i;
}
else
{
T[i] = T[Max]+value2;
Max = i;
}
}
}
ll Minn = 0;
for(int i = 1; i<= n; i++) Minn = min(Minn, T[i]);
for(int i = 1; i<= n; i++) T[i] += abs(Minn)+1;
for(int i = 1; i<= n; i++) answer(i, T[i]);
}
Compilation message (stderr)
xylophone.cpp: In function 'void solve(int)':
xylophone.cpp:20:8: warning: unused variable 'ptr' [-Wunused-variable]
20 | ll ptr = 1;
| ^~~
xylophone.cpp:21:8: warning: unused variable 'cur' [-Wunused-variable]
21 | ll cur = T[2];
| ^~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |