제출 #1006977

#제출 시각아이디문제언어결과실행 시간메모리
1006977faqinyeagerGrowing Vegetables is Fun 4 (JOI21_ho_t1)C++17
0 / 100
0 ms348 KiB
#include <bits/stdc++.h> #define ff first #define ss second using namespace std; using ll = long long; int n; vector<ll> a, pref, suff; int main(){ cin >> n; a.resize(n); pref.resize(n, 0); suff.resize(n, 0); for(int i = 0; i < n; i++) cin >> a[i]; for(int i = 1; i < n; i++) if(a[i - 1] >= a[i]) pref[i] = a[i - 1] - a[i] + 1; for(int i = n - 2; i >= 0; i--) if(a[i] <= a[i + 1]) suff[i] = a[i + 1] - a[i] + 1; for(int i = 1; i < n; i++) pref[i] += pref[i - 1]; for(int i = n - 2; i >= 0; i--) suff[i] += suff[i + 1]; if(pref[n - 1] == 0 || suff[0] == 0){ cout << 0; return 0; } for(int i = 0; i < n; i++) cout << pref[i] << ' '; cout << '\n'; for(int i = 0; i < n; i++) cout << suff[i] << ' '; cout << "\n\n"; ll ans = 1e14; for(int i = 0; i < n; i++){ ans = min(ans, max(pref[i], suff[i])); } cout << ans; }

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

Main.cpp: In function 'int main()':
Main.cpp:29:5: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   29 |     for(int i = 0; i < n; i++) cout << pref[i] << ' '; cout << '\n';
      |     ^~~
Main.cpp:29:56: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   29 |     for(int i = 0; i < n; i++) cout << pref[i] << ' '; cout << '\n';
      |                                                        ^~~~
Main.cpp:30:5: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   30 |     for(int i = 0; i < n; i++) cout << suff[i] << ' '; cout << "\n\n";
      |     ^~~
Main.cpp:30:56: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   30 |     for(int i = 0; i < n; i++) cout << suff[i] << ' '; cout << "\n\n";
      |                                                        ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...