제출 #99291

#제출 시각아이디문제언어결과실행 시간메모리
99291MercenaryCave (IOI13_cave)C++14
컴파일 에러
0 ms0 KiB
#include "graderlib.c" #include "cave.h" const int maxn = 5005; int ans[maxn]; int pos[maxn]; bool vis[maxn]; void FILL_N(int l , int r , int val) { for(int i = l ; i <= r ; ++i){ if(vis[i])continue; ans[i] = val; } } void exploreCave(int n) { for(int i = 0 ; i < n ; ++i) { FILL_N(0,n-1,0); bool ansi = (tryCombination(ans) == i); // tryCombination(ans) == i -> ith door is block -> ans for ith door is 1 //else ans for ith door is 0 //now we need to find which switch connects to ith door int l = 0 , h = n - 1; while(l < h) { // FILL_N(0,n-1,!ansi); int mid = l + h >> 1; FILL_N(l , mid , ansi); FILL_N(mid + 1 , h , !ansi); if(tryCombination(ans) == i){ FILL_N(l , mid , !ansi); l = mid + 1; } else{ h = mid; } } // printf("%d%d\n" , l , ansi); pos[l] = i; vis[l] = 1; ans[l] = ansi; } return answer(ans,pos); }

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

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:30:25: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
             int mid = l + h >> 1;
                       ~~^~~
/tmp/cc8q3GPc.o: In function `answer':
cave.cpp:(.text+0x0): multiple definition of `answer'
/tmp/ccMK0OpR.o:grader.c:(.text+0x0): first defined here
/tmp/cc8q3GPc.o: In function `tryCombination':
cave.cpp:(.text+0x90): multiple definition of `tryCombination'
/tmp/ccMK0OpR.o:grader.c:(.text+0x90): first defined here
/tmp/cc8q3GPc.o: In function `init()':
cave.cpp:(.text+0x140): multiple definition of `init()'
/tmp/ccMK0OpR.o:grader.c:(.text+0x140): first defined here
collect2: error: ld returned 1 exit status