Submission #975597

#TimeUsernameProblemLanguageResultExecution timeMemory
975597IsamGrowing Vegetables is Fun 4 (JOI21_ho_t1)C++17
0 / 100
1 ms476 KiB
#include<bits/stdc++.h> using namespace std; #define eb emplace_back #define all(x) x.begin(), x.end() constexpr int sz = 2e5 + 5; int n, a[sz], pref[sz], suff[sz], b[sz]; int ans = (int)1E9; signed main(){ ios_base::sync_with_stdio(0), cin.tie(0); cin >> n; for(register int i = 1; i <= n; ++i){ cin >> a[i], b[i] = a[i]; } for(register int i = 1; i <= n; ++i){ pref[i] = pref[i-1]; if(b[i] > b[i-1]) continue; b[i] = (pref[i] += b[i-1] - b[i] + 1, b[i-1] + 1); } for(register int i = n; i >= 1; --i){ suff[i] = suff[i+1]; if(a[i] > a[i+1]) continue; a[i] = (suff[i] += a[i+1] - a[i] + 1, a[i+1] + 1); } for(register int i = 1; i <= n; ++i){ ans = min(ans, max(pref[i], suff[i])); } cout << ans << '\n'; }

Compilation message (stderr)

Main.cpp: In function 'int main()':
Main.cpp:16:19: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   16 |  for(register int i = 1; i <= n; ++i){
      |                   ^
Main.cpp:20:19: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   20 |  for(register int i = 1; i <= n; ++i){
      |                   ^
Main.cpp:26:19: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   26 |  for(register int i = n; i >= 1; --i){
      |                   ^
Main.cpp:32:19: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   32 |  for(register int i = 1; i <= n; ++i){
      |                   ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...