Submission #859290

#TimeUsernameProblemLanguageResultExecution timeMemory
859290nguyentunglamCoins (IOI17_coins)C++17
Compilation error
0 ms0 KiB
#include "coins.h" std::vector<int> coin_flips(std::vector<int> b, int c) { vector<int> flips; for(int i = 0; i < 64; i++) if (i != c && b[i] == 1) flip.push_back(i); if (b[c] == 0) flip.push_back(c); if (flip.empty()) { flip.push_back(0); flip.push_back(0); } return flips; } int find_coin(std::vector<int> b) { for(int i = 0; i < 64; i++) if (b[i]) return i; }

Compilation message (stderr)

coins.cpp: In function 'std::vector<int> coin_flips(std::vector<int>, int)':
coins.cpp:4:4: error: 'vector' was not declared in this scope
    4 |    vector<int> flips;
      |    ^~~~~~
coins.cpp:4:4: 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:4:11: error: expected primary-expression before 'int'
    4 |    vector<int> flips;
      |           ^~~
coins.cpp:5:57: error: 'flip' was not declared in this scope
    5 |    for(int i = 0; i < 64; i++) if (i != c && b[i] == 1) flip.push_back(i);
      |                                                         ^~~~
coins.cpp:6:19: error: 'flip' was not declared in this scope
    6 |    if (b[c] == 0) flip.push_back(c);
      |                   ^~~~
coins.cpp:7:8: error: 'flip' was not declared in this scope
    7 |    if (flip.empty()) {
      |        ^~~~
coins.cpp:11:11: error: 'flips' was not declared in this scope
   11 |    return flips;
      |           ^~~~~
coins.cpp: In function 'int find_coin(std::vector<int>)':
coins.cpp:16:1: warning: control reaches end of non-void function [-Wreturn-type]
   16 | }
      | ^