Submission #860962

#TimeUsernameProblemLanguageResultExecution timeMemory
860962BlancaHMCoins (IOI17_coins)C++14
Compilation error
0 ms0 KiB
#include "coins.h" using namespace std; vector<int> coin_flips(vector<int> b, int c) { vector<int> flips; // Es obligatorio girar al menos una casilla => giremos una que no usemos flips.append(63); // Guardaremos c en binario en las primeras 7 casillas for (int i = 0; i <= 6; i++) { if ((b[i]<<i) != c & (1<<i)) { flips.append(i); } } return flips; } int find_coin(vector<int> b) { // Convertimos la representacion binaria en decimal int c = 0; for (int i = 0; i <= 6; i++) { c += (1<<b[i]); } return c; }

Compilation message (stderr)

coins.cpp: In function 'std::vector<int> coin_flips(std::vector<int>, int)':
coins.cpp:7:11: error: 'class std::vector<int>' has no member named 'append'
    7 |     flips.append(63);
      |           ^~~~~~
coins.cpp:10:23: warning: suggest parentheses around comparison in operand of '&' [-Wparentheses]
   10 |         if ((b[i]<<i) != c & (1<<i)) {
      |             ~~~~~~~~~~^~~~
coins.cpp:11:19: error: 'class std::vector<int>' has no member named 'append'
   11 |             flips.append(i);
      |                   ^~~~~~