제출 #104400

#제출 시각아이디문제언어결과실행 시간메모리
104400Badral커다란 상품 (IOI17_prize)C++17
컴파일 에러
0 ms0 KiB
#include<bits/stdc++.h> #include "prize.h" int can(int k) { vector<int> cer = ask(k); if(cer[0] == 0 && cer[1] == 0) return 2; if(cer[0] == 1) return 0; return 1; } int find_best(int n) { for(int i = 0; i < n; i++) { std::vector<int> res = ask(i); if(res[0] + res[1] == 0) return i; } int kk = 0; for(int i = n; i >= 1; i /= 2) {} int p = can(i+kk); if(p == 2) return i+kk; while(i+kk <= n && p) kk += i; } return kk; }

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

prize.cpp: In function 'int can(int)':
prize.cpp:5:2: error: 'vector' was not declared in this scope
  vector<int> cer = ask(k);
  ^~~~~~
prize.cpp:5:2: note: suggested alternative:
In file included from /usr/include/c++/7/vector:64:0,
                 from /usr/include/c++/7/functional:61,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:71,
                 from prize.cpp:1:
/usr/include/c++/7/bits/stl_vector.h:216:11: note:   'std::vector'
     class vector : protected _Vector_base<_Tp, _Alloc>
           ^~~~~~
prize.cpp:5:9: error: expected primary-expression before 'int'
  vector<int> cer = ask(k);
         ^~~
prize.cpp:6:5: error: 'cer' was not declared in this scope
  if(cer[0] == 0 && cer[1] == 0) 
     ^~~
prize.cpp:8:5: error: 'cer' was not declared in this scope
  if(cer[0] == 1) return 0;
     ^~~
prize.cpp: In function 'int find_best(int)':
prize.cpp:20:15: error: 'i' was not declared in this scope
   int p = can(i+kk);
               ^
prize.cpp: At global scope:
prize.cpp:26:2: error: expected unqualified-id before 'return'
  return kk;
  ^~~~~~
prize.cpp:27:1: error: expected declaration before '}' token
 }
 ^