제출 #393407

#제출 시각아이디문제언어결과실행 시간메모리
393407ahmetGrowing Vegetables is Fun 4 (JOI21_ho_t1)C++14
100 / 100
33 ms6892 KiB
#include <bits/stdc++.h> using namespace std; #define zaman cout<<endl<<fixed<<setprecision(2)<<1000.0 * clock() / CLOCKS_PER_SEC<< " milliseconds " #define rep(i,n) for(long long (i)=0;(i)<(n);++(i)) #define ref(i,a,b) for (long long (i)=(a); (i)<=(b); ++(i)) #define endl '\n' #define ll long long #define pb push_back #define pii pair<ll,ll> #define mp make_pair const int mx=2e5+6; ll l[mx],r[mx]; int main(){ ios_base::sync_with_stdio(0);cin.tie(0); ll n;cin >> n; ll ans=1e18+2; vector <ll> a(n+1); ref(i,1,n)cin >> a[i]; ref(i,2,n){ l[i]=l[i-1]+max(0LL,a[i-1]-a[i]+1); } for(int i=n-1;i>=1;--i){ r[i]=r[i+1]+max(0LL,a[i+1]-a[i]+1); } for(int i=1;i<=n;++i){ ans=min(ans,max(l[i],r[i])); } cout << ans << endl; }

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

Main.cpp: In function 'int main()':
Main.cpp:5:35: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
    5 | #define ref(i,a,b) for (long long (i)=(a); (i)<=(b); ++(i))
      |                                   ^
Main.cpp:18:2: note: in expansion of macro 'ref'
   18 |  ref(i,1,n)cin >> a[i];
      |  ^~~
Main.cpp:5:35: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
    5 | #define ref(i,a,b) for (long long (i)=(a); (i)<=(b); ++(i))
      |                                   ^
Main.cpp:19:2: note: in expansion of macro 'ref'
   19 |  ref(i,2,n){
      |  ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...