제출 #820859

#제출 시각아이디문제언어결과실행 시간메모리
820859vjudge1커다란 상품 (IOI17_prize)C++14
컴파일 에러
0 ms0 KiB
#include<bits/stdc++.h> //#include "prize.h" using namespace std ; int cnt ; vector<int> ask(int ind) { cnt++ ; vector<int> v(2) ; cout << "? " << ind << '\n' ; cin >> v[0] >> v[1] ; return v ; } int find_best(int n) { bool flag = 0 ; int l = -1, r = n ; while(l + 1 < r) { int mid = (l + r) / 2 ; vector<int> v = ask(mid) ; if(v[0] && v[1]) { flag = 1 ; break ; } if(!v[0] && !v[1]) return mid ; else { if(v[0]) r = mid ; else l = mid ; } } if(!flag) return l ; int ind = 0 ; while(ind < n) { vector<int> abu = ask(ind) ; if(cnt == 10000) { while(true) { } } if(!abu[0] && !abu[1]) return ind ; int l = ind, r = n ; while(l + 1 < r) { int mid = (l + r) >> 1 ; vector<int> now = ask(mid) ; if(cnt == 10000) { while(true) { } } cnt++ ; if(!now[0] && !now[1]) return mid ; else { if(now[0] == abu[0] && now[1] == abu[1]) l = mid ; else r = mid ; } } ind = l + 1 ; } } signed main() { int n ; cin >> n ; cout<<find_best(n) ; return 0 ; }

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

prize.cpp: In function 'int find_best(int)':
prize.cpp:74:1: warning: control reaches end of non-void function [-Wreturn-type]
   74 | }
      | ^
/usr/bin/ld: /tmp/ccl9ID1Q.o: in function `ask(int)':
grader.cpp:(.text+0x80): multiple definition of `ask(int)'; /tmp/ccMnTn4R.o:prize.cpp:(.text+0x0): first defined here
/usr/bin/ld: /tmp/ccl9ID1Q.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccMnTn4R.o:prize.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status