제출 #941411

#제출 시각아이디문제언어결과실행 시간메모리
941411tset동굴 (IOI13_cave)C++14
컴파일 에러
0 ms0 KiB
#include<bits/stdc++.h> //#include"cave.h" using namespace std; int S[1<<20], D[1<<20]; int N; int tryCombination(int comb[]) { int mini = 1<<20; for (int i = 0; i < N; i++) if (S[i] != comb[i]) mini = min (mini, D[i]); if (mini == 1<<20) mini = -1; return mini; } void answer (int arr[], int otro[]) { for (int i = 0; i < N; i++) if (arr[i] != S[i]) { cout << "WA"; return; } for (int i = 0; i < N; i++) if (otro[i] != D[i]) { cout << "WA"; return; } cout << "AC"; } void imprime (int arr[]) { for (int i = 0; i < N; i++) cout << arr[i] << " "; cout << '\n'; } vector<int> posLevierOpt, corresp; bool test(int deb, int fin, int porteAOuvrir, int N) { int tabTest[N]; for(int i=0; i<N; i++) { if(posLevierOpt[i]!= -1) tabTest[i] = posLevierOpt[i]; else if(i>= deb && i <= fin) tabTest[i] = 1; else tabTest[i] = 0; } int firstDoorClosed = tryCombination(tabTest); if(firstDoorClosed == -1 || firstDoorClosed > porteAOuvrir) return true; return false; } void exploreCave(int N) { posLevierOpt.assign(N, -1); corresp.assign(N, -1); for(int iDoor = 0; iDoor< N; iDoor++) { bool stateDoorInit = test(N, N, iDoor, N); int deb = 0; int fin = N-1; while (deb < fin) { int mid = (deb + fin)/2; int res = test(deb, mid, iDoor, N); if(res!=stateDoorInit) fin = mid; else deb = mid +1; } if(stateDoorInit) posLevierOpt[deb] = 0; else posLevierOpt[deb] = 1; corresp[deb] = iDoor; } int answer1[N], answer2[N]; for(int i=0; i< N;i++) answer1[i] = posLevierOpt[i]; for(int i=0; i< N;i++) answer2[i] = corresp[i]; answer(answer1, answer2); } int main() { cin >> N; for(int i =0; i<N; i++) cin >> S[i]; for(int i=0; i<N; i++) cin >> D[i]; exploreCave(N); }

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

/usr/bin/ld: /tmp/cc8VI15J.o: in function `main':
cave.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccDqybUI.o:grader.c:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/ccDqybUI.o: in function `main':
grader.c:(.text.startup+0x10): undefined reference to `exploreCave'
collect2: error: ld returned 1 exit status