Submission #763072

#TimeUsernameProblemLanguageResultExecution timeMemory
763072NhanBeooXylophone (JOI18_xylophone)C++17
0 / 100
0 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 = (i-1, i); int y = (i-2, i); if((x == y and a[i-2] > a[i-1]) or (x != y 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); }

Compilation message (stderr)

xylophone.cpp: In function 'void solve(int)':
xylophone.cpp:25:13: warning: left operand of comma operator has no effect [-Wunused-value]
   25 |   int x = (i-1, i);
      |            ~^~
xylophone.cpp:26:13: warning: left operand of comma operator has no effect [-Wunused-value]
   26 |   int y = (i-2, i);
      |            ~^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...