제출 #242322

#제출 시각아이디문제언어결과실행 시간메모리
242322jamielim마상시합 토너먼트 (IOI12_tournament)C++14
컴파일 에러
0 ms0 KiB
int GetBestPosition(int N, int C, int R, int *K, int *S, int *E){ int maxi=0,ans=0; for(int p=0;p<N;p++){ int cur=0; int arr[N];arr[p]=R; for(int i=0;i<N;i++){ if(i<p)arr[i]=K[i]; else if(i>p)arr[i]=K[i-1]; } for(int i=0;i<C;i++){ int m=0; for(int j=S[i];j<=E[i];j++){ m=max(m,arr[j]); } arr[S[i]]=m; if(m==R)cur++; for(int j=S[i]+1;j<N-E[i]+S[i];j++){ arr[j]=arr[j+E[i]-S[i]]; } } if(cur>maxi){maxi=cur;ans=p;} } return maxi; }

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

tournament.cpp: In function 'int GetBestPosition(int, int, int, int*, int*, int*)':
tournament.cpp:13:7: error: 'max' was not declared in this scope
     m=max(m,arr[j]);
       ^~~
tournament.cpp:13:7: note: suggested alternative: 'maxi'
     m=max(m,arr[j]);
       ^~~
       maxi