제출 #704223

#제출 시각아이디문제언어결과실행 시간메모리
704223Hiennoob123Xylophone (JOI18_xylophone)C++14
0 / 100
1 ms208 KiB
#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]); }

컴파일 시 표준 에러 (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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...