Submission #242322

# Submission time Handle Problem Language Result Execution time Memory
242322 2020-06-27T08:51:13 Z jamielim Jousting tournament (IOI12_tournament) C++14
Compilation error
0 ms 0 KB
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;
}

Compilation message

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