제출 #692578

#제출 시각아이디문제언어결과실행 시간메모리
692578XiaoyangCoins (IOI17_coins)C++17
컴파일 에러
0 ms0 KiB
#include "coins.h" std::vector<int> coin_flips(std::vector<int> b, int c) { vector<int>flips; rep(i,0,8){ if((1<<i)&c){ if(b[i]==0)flips.pb(i); }else{ if(b[i]==1)flips.pb(i); } } return flips; } int find_coin(std::vector<int> b) { ll ret=0; rep(i,0,8){ if(b[i])ret+=(1<<i); } return ret; }

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

coins.cpp: In function 'std::vector<int> coin_flips(std::vector<int>, int)':
coins.cpp:3:5: error: 'vector' was not declared in this scope
    3 |     vector<int>flips;
      |     ^~~~~~
coins.cpp:3:5: note: suggested alternatives:
In file included from /usr/include/c++/10/vector:67,
                 from coins.h:1,
                 from coins.cpp:1:
/usr/include/c++/10/bits/stl_vector.h:389:11: note:   'std::vector'
  389 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
In file included from coins.h:1,
                 from coins.cpp:1:
/usr/include/c++/10/vector:86:13: note:   'std::pmr::vector'
   86 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
      |             ^~~~~~
coins.cpp:3:12: error: expected primary-expression before 'int'
    3 |     vector<int>flips;
      |            ^~~
coins.cpp:4:6: error: 'i' was not declared in this scope
    4 |  rep(i,0,8){
      |      ^
coins.cpp:4:2: error: 'rep' was not declared in this scope
    4 |  rep(i,0,8){
      |  ^~~
coins.cpp:11:12: error: 'flips' was not declared in this scope
   11 |     return flips;
      |            ^~~~~
coins.cpp: In function 'int find_coin(std::vector<int>)':
coins.cpp:14:4: error: 'll' was not declared in this scope
   14 |    ll ret=0;
      |    ^~
coins.cpp:15:8: error: 'i' was not declared in this scope
   15 |    rep(i,0,8){
      |        ^
coins.cpp:15:4: error: 'rep' was not declared in this scope
   15 |    rep(i,0,8){
      |    ^~~
coins.cpp:18:11: error: 'ret' was not declared in this scope
   18 |    return ret;
      |           ^~~