제출 #385463

#제출 시각아이디문제언어결과실행 시간메모리
385463BlancaHMCoins (IOI17_coins)C++14
컴파일 에러
0 ms0 KiB
#include "coins.h" using namespace std; vector<int> coin_flips(vector<int> b, int c) { vector<int> flips(); int val = 0; for (int i = 0; i < (int) b.size(); i++) { if (b[i]) val ^= i; } if (val == c) flips.push_back(0); else flips.push_back(val^c); return flips; } int find_coin(vector<int> b) { int val = 0; for (int i = 0; i < (int) b.size(); i++) { if (b[i]) val ^= i; } return val; }

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

coins.cpp: In function 'std::vector<int> coin_flips(std::vector<int>, int)':
coins.cpp:11:15: error: request for member 'push_back' in 'flips', which is of non-class type 'std::vector<int>()'
   11 |         flips.push_back(0);
      |               ^~~~~~~~~
coins.cpp:13:15: error: request for member 'push_back' in 'flips', which is of non-class type 'std::vector<int>()'
   13 |         flips.push_back(val^c);
      |               ^~~~~~~~~
coins.cpp:14:12: error: could not convert 'flips' from 'std::vector<int>()' to 'std::vector<int>'
   14 |     return flips;
      |            ^~~~~
      |            |
      |            std::vector<int>()