제출 #379507

#제출 시각아이디문제언어결과실행 시간메모리
379507penguin133Growing Vegetables is Fun 4 (JOI21_ho_t1)C++14
100 / 100
93 ms5740 KiB
#include <bits/stdc++.h> using namespace std; #define int long long int A[200005], P[200005], S[200005],ans = LLONG_MAX; main(){ int n; cin >> n; for(int i=1;i<=n;i++){ cin >> A[i]; if(i > 1){ P[i] = P[i-1] + max(0ll, A[i-1]- A[i] + 1); } } for(int i=n-1;i>=1;i--)S[i] = S[i+1] + max(0ll, A[i+1] - A[i] + 1); for(int i=1;i<=n;i++)ans = min(ans, max(P[i], S[i])); cout << ans; }

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

Main.cpp:5:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    5 | main(){
      |      ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...