제출 #333044

#제출 시각아이디문제언어결과실행 시간메모리
333044gouravkhungerCoins (IOI17_coins)C++14
컴파일 에러
0 ms0 KiB
#include "coins.h" std::vector<int> coin_flips(std::vector<int> b, int c) { int k=1; vector<int> labels(k); if (b[0] == 1) { labels[0] = 0; } else if(b[1]==0){ labels[0] = 1; } return labels; } int find_coin(std::vector<int> b) { if (b[0] == 0) { return 0; } return 1; }

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

coins.cpp: In function 'std::vector<int> coin_flips(std::vector<int>, int)':
coins.cpp:5:5: error: 'vector' was not declared in this scope; did you mean 'std::vector'?
    5 |     vector<int> labels(k);
      |     ^~~~~~
      |     std::vector
In file included from /usr/include/c++/9/vector:67,
                 from coins.h:1,
                 from coins.cpp:1:
/usr/include/c++/9/bits/stl_vector.h:386:11: note: 'std::vector' declared here
  386 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
coins.cpp:5:12: error: expected primary-expression before 'int'
    5 |     vector<int> labels(k);
      |            ^~~
coins.cpp:7:9: error: 'labels' was not declared in this scope
    7 |         labels[0] = 0;
      |         ^~~~~~
coins.cpp:9:9: error: 'labels' was not declared in this scope
    9 |         labels[0] = 1;
      |         ^~~~~~
coins.cpp:11:12: error: 'labels' was not declared in this scope
   11 |     return labels;
      |            ^~~~~~
coins.cpp:4:9: warning: unused variable 'k' [-Wunused-variable]
    4 |     int k=1;
      |         ^