Submission #1141467

#TimeUsernameProblemLanguageResultExecution timeMemory
11414671anh6Coins (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)
            std::flips.push_back(i);
        else if(!(c & (1 << i) && b[i] == 1)
            std::flips.push_back(i);
    std::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:8:18: error: 'flips' is not a member of 'std'
    8 |             std::flips.push_back(i);
      |                  ^~~~~
coins.cpp:9:45: error: expected ';' before 'std'
    9 |         else if(!(c & (1 << i) && b[i] == 1)
      |                                             ^
      |                                             ;
   10 |             std::flips.push_back(i);
      |             ~~~                              
coins.cpp:11:10: error: 'flips' is not a member of 'std'
   11 |     std::flips.push_back(7);
      |          ^~~~~
coins.cpp:11:28: error: expected ')' before ';' token
   11 |     std::flips.push_back(7);
      |                            ^
      |                            )
coins.cpp:9:16: note: to match this '('
    9 |         else if(!(c & (1 << i) && b[i] == 1)
      |                ^