제출 #991061

#제출 시각아이디문제언어결과실행 시간메모리
991061messiuuuuuCoins (IOI17_coins)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #include "coins.h" using namespace std; std::vector<int> coin_flips(vector<int> b, int c) { vector<int> ans; int cnt = 0; for (int i = 0; i < 2; i++) { if (b[i]) cnt++; } if (c == 1) { if (cnt == 1) ans.push_back(2); else b[1] = ans.push_back(1); } else { if (cnt == 1) ans.push_back(1); else b[2] = ans.push_back(2); } return ans; } int find_coin(vector<int> b) { int cnt = 0; for (int i = 0; i < 2; i++) { if (b[i]) cnt++; } if (cnt == 1) return 1; return 0; }

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

coins.cpp: In function 'std::vector<int> coin_flips(std::vector<int>, int)':
coins.cpp:14:34: error: void value not ignored as it ought to be
   14 |         else b[1] = ans.push_back(1);
      |                     ~~~~~~~~~~~~~^~~
coins.cpp:18:34: error: void value not ignored as it ought to be
   18 |         else b[2] = ans.push_back(2);
      |                     ~~~~~~~~~~~~~^~~