제출 #975641

#제출 시각아이디문제언어결과실행 시간메모리
975641IsamGrowing Vegetables is Fun 4 (JOI21_ho_t1)C++17
100 / 100
22 ms7104 KiB
#include<bits/stdc++.h> using namespace std; #define eb emplace_back #define all(x) x.begin(), x.end() #define int long long constexpr int sz = 2e5 + 5; int n, a[sz], pref[sz], suff[sz]; int ans = (int)1E18 + 7; signed main(){ ios_base::sync_with_stdio(0), cin.tie(0); cin >> n; for(register int i = 1; i <= n; ++i){ cin >> a[i]; } for(register int i = 1; i <= n; ++i){ pref[i] = pref[i-1] + max(0ll, a[i-1] - a[i] + 1); } for(register int i = n; i >= 1; --i){ suff[i] = suff[i+1] + max(0ll, a[i+1] - a[i] + 1); } for(register int i = 1; i <= n; ++i){ ans = min(ans, max(pref[i], suff[i])); } cout << ans << '\n'; }

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

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