Submission #1141466

#TimeUsernameProblemLanguageResultExecution timeMemory
11414661anh6Coins (IOI17_coins)C++20
Compilation error
0 ms0 KiB
#include "coins.h" std::vector<int> coin_flips(std::vector<int> b, int c) { std::vector<int> flips; int suma = 0; for(int i = 0; i < 6; i++) if((c & (1 << i)) && b[i] == 0) flips.push_back(i); else if(!(c & (1 << i) && b[i] == 1) flips.push_back(i); flips.push_back(7); return flips; } int find_coin(std::vector<int> b) { int suma = 0; for(int i = 0; i < 6; i++) suma += (b[i] << i); return suma; }

Compilation message (stderr)

coins.cpp: In function 'std::vector<int> coin_flips(std::vector<int>, int)':
coins.cpp:9:45: error: expected ';' before 'flips'
    9 |         else if(!(c & (1 << i) && b[i] == 1)
      |                                             ^
      |                                             ;
   10 |             flips.push_back(i);
      |             ~~~~~                            
coins.cpp:11:23: error: expected ')' before ';' token
   11 |     flips.push_back(7);
      |                       ^
      |                       )
coins.cpp:9:16: note: to match this '('
    9 |         else if(!(c & (1 << i) && b[i] == 1)
      |                ^
coins.cpp:11:20: error: could not convert 'flips.std::vector<int>::push_back(7)' from 'void' to 'bool'
   11 |     flips.push_back(7);
      |     ~~~~~~~~~~~~~~~^~~
      |                    |
      |                    void