제출 #649996

#제출 시각아이디문제언어결과실행 시간메모리
649996tigarGrowing Vegetables is Fun 4 (JOI21_ho_t1)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; void speed() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); } ll a[n+2]; ll preff[n], suff[n]; int main() { speed(); int n; cin>>n; for(int i=0; i<n; i++)cin>>a[i]; ll razlike[n]; razlike[0]=0; //razlike[i]=a[i]-a[i-1] for(int i=1; i<n; i++)razlike[i]=a[i]-a[i-1]; preff[0]=0; suff[n-1]=0; for(int i=1; i<n; i++) { if(razlike[i]<=0)preff[i]=-razlike[i]+1; preff[i]+=preff[i-1]; } for(int i=n-2; i>=0; i--) { if(razlike[i+1]>=0)suff[i]=razlike[i+1]+1; suff[i]+=suff[i+1]; } //for(int i=0; i<n; i++)cout<<suff[i]<<" "<<preff[i]<<" "<<razlike[i]<<endl; ll rezz=INT_MAX; for(int i=0; i<n; i++) { rezz=min(rezz, max(suff[i], preff[i])); } cout<<rezz; return 0; }

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

Main.cpp:10:6: error: 'n' was not declared in this scope; did you mean 'yn'?
   10 | ll a[n+2];
      |      ^
      |      yn
Main.cpp:11:10: error: 'n' was not declared in this scope; did you mean 'yn'?
   11 | ll preff[n], suff[n];
      |          ^
      |          yn
Main.cpp:11:19: error: 'n' was not declared in this scope; did you mean 'yn'?
   11 | ll preff[n], suff[n];
      |                   ^
      |                   yn
Main.cpp: In function 'int main()':
Main.cpp:17:32: error: 'a' was not declared in this scope
   17 |     for(int i=0; i<n; i++)cin>>a[i];
      |                                ^
Main.cpp:19:38: error: 'a' was not declared in this scope
   19 |     for(int i=1; i<n; i++)razlike[i]=a[i]-a[i-1];
      |                                      ^
Main.cpp:21:5: error: 'preff' was not declared in this scope
   21 |     preff[0]=0; suff[n-1]=0;
      |     ^~~~~
Main.cpp:21:17: error: 'suff' was not declared in this scope
   21 |     preff[0]=0; suff[n-1]=0;
      |                 ^~~~