제출 #781282

#제출 시각아이디문제언어결과실행 시간메모리
781282OrazB커다란 상품 (IOI17_prize)C++14
컴파일 에러
0 ms0 KiB
#include "prize.h" int find_best(int n) { int l = 0, r = n; while(l <= r){ int md = (l+r)/2; vector<int> a = ask(md); if (a[0] == a[1]) return md; if (a[0] > a[1]) r = md - 1; else l = md + 1; } }

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

prize.cpp: In function 'int find_best(int)':
prize.cpp:7:3: error: 'vector' was not declared in this scope; did you mean 'std::vector'?
    7 |   vector<int> a = ask(md);
      |   ^~~~~~
      |   std::vector
In file included from /usr/include/c++/10/vector:67,
                 from prize.h:1,
                 from prize.cpp:1:
/usr/include/c++/10/bits/stl_vector.h:389:11: note: 'std::vector' declared here
  389 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
prize.cpp:7:10: error: expected primary-expression before 'int'
    7 |   vector<int> a = ask(md);
      |          ^~~
prize.cpp:8:7: error: 'a' was not declared in this scope
    8 |   if (a[0] == a[1]) return md;
      |       ^
prize.cpp:9:7: error: 'a' was not declared in this scope
    9 |   if (a[0] > a[1]) r = md - 1;
      |       ^
prize.cpp:12:1: warning: control reaches end of non-void function [-Wreturn-type]
   12 | }
      | ^