제출 #548191

#제출 시각아이디문제언어결과실행 시간메모리
548191PherokungGrowing Vegetables is Fun 4 (JOI21_ho_t1)C++14
0 / 100
1 ms344 KiB
#include<bits/stdc++.h> using namespace std; long long n,a[200005],v0[200005],v1[200005],ans=1e9; int main(){ scanf("%lld",&n); for(int i=1;i<=n;i++) scanf("%lld",&a[i]); for(int i=1;i<=n;i++) v0[i] = v0[i-1] + max((long long)0,a[i-1]-a[i]+1); for(int i=n;i>=1;i--) v1[i] = v1[i+1] + max((long long)0,a[i+1]-a[i]+1); for(int i=1;i<=n;i++) ans = min(ans,max(v0[i],v1[i])); printf("%lld",ans); }

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

Main.cpp: In function 'int main()':
Main.cpp:5:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    5 |  scanf("%lld",&n);
      |  ~~~~~^~~~~~~~~~~
Main.cpp:6:29: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    6 |  for(int i=1;i<=n;i++) scanf("%lld",&a[i]);
      |                        ~~~~~^~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...