제출 #20234

#제출 시각아이디문제언어결과실행 시간메모리
20234rubabredwan마상시합 토너먼트 (IOI12_tournament)C++98
컴파일 에러
0 ms0 KiB
#include <iostream> #include <algorithm> #define optimizar_io ios_base::sync_with_stdio(0);cin.tie(0); using namespace std; int n, N, c, r; int R; int K[502]; int B[502], E[502]; int P[502]; int ans = -1, idx; void inicializa( int p ){ int i; N = n; for( i = 0; i < p; i++ ) P[i] = K[i]; P[p] = r; for( i = p + 1; i < n; i++ ) P[i] = K[i - 1]; } int maxi( int i, int j ){ int ret = -1; for( ; i <= j; i++ ) ret = max( ret, P[i] ); return ret; } void recorre( int i, int j, int w ){ P[i] = w; int aux = j - i; for( j = j + 1; j < N; j++ ) P[++i] = P[j]; N -= aux; } int main(){ optimizar_io cin >> n >> c >> r; for( int i = 0; i < n - 1; i++ ) cin >> K[i]; for( int i = 1; i <= c; i++ ) cin >> B[i] >> E[i]; for( int i = 0; i < n; i++ ){ inicializa( i ); R = i; int tmp = 0; for( int j = 1; j <= c; j++ ){ int winner = maxi( B[j], E[j] ); recorre( B[j], E[j], winner ); if( R >= B[j] && R <= E[j] ){ if( winner == r ) tmp++; else break; } for( R = 0; R < N; R++ ) if( P[R] == r ) break; } if( tmp > ans ){ ans = tmp; idx = i; } } cout << idx << "\n"; return 0; }

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

/tmp/ccnk2Bqq.o: In function `main':
tournament.cpp:(.text.startup+0x0): multiple definition of `main'
/tmp/cc8Oe9o1.o:grader.cpp:(.text.startup+0x0): first defined here
/tmp/cc8Oe9o1.o: In function `main':
grader.cpp:(.text.startup+0x104): undefined reference to `GetBestPosition(int, int, int, int*, int*, int*)'
collect2: error: ld returned 1 exit status