Submission #763078

#TimeUsernameProblemLanguageResultExecution timeMemory
763078NhanBeooXylophone (JOI18_xylophone)C++17
0 / 100
1 ms208 KiB
#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((x == y + abs(a[i-1] - a[i-2]) and a[i-2] > a[i-1]) or (x != y + abs(a[i-1] - a[i-2]) 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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...