제출 #508902

#제출 시각아이디문제언어결과실행 시간메모리
508902ITOGrowing Vegetables is Fun 4 (JOI21_ho_t1)C++11
100 / 100
96 ms7016 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; ll a[200001], b[200001][2]; int main() { int n; ll c = 100000000000000000, x, cl = 0, cr = 0; cin >> n; for (int i = 0; i < n; i++) { cin >> a[i]; } b[0][0] = 0; b[n - 1][1] = 0; for (int i = 1; i < n; i++) { b[i][0] = b[i - 1][0] + max(0ll, a[i - 1] - a[i] + 1); } for (int i = n - 2; i >= 0; i--) { b[i][1] = b[i + 1][1] + max(0ll, a[i + 1] - a[i] + 1); } for (int i = 0; i < n; i++) { c = min(c, max(b[i][0], b[i][1])); } cout << c << '\n'; return 0; }

컴파일 시 표준 에러 (stderr) 메시지

Main.cpp: In function 'int main()':
Main.cpp:7:32: warning: unused variable 'x' [-Wunused-variable]
    7 |     ll c = 100000000000000000, x, cl = 0, cr = 0;
      |                                ^
Main.cpp:7:35: warning: unused variable 'cl' [-Wunused-variable]
    7 |     ll c = 100000000000000000, x, cl = 0, cr = 0;
      |                                   ^~
Main.cpp:7:43: warning: unused variable 'cr' [-Wunused-variable]
    7 |     ll c = 100000000000000000, x, cl = 0, cr = 0;
      |                                           ^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...