Submission #1080222

#TimeUsernameProblemLanguageResultExecution timeMemory
1080222MihailoCoins (IOI17_coins)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; std::vector<int> coin_flips(std::vector<int> b, int c) { std::vector<int> flips; flips.pb(c); for(int i=0; i<b.size(); i++) { flips[0]^=b[i]; } return flips; } int find_coin(std::vector<int> b) { int rez=0; for(int i=0; i<b.size(); i++) { rez[0]^=b[i]; } return rez; }

Compilation message (stderr)

coins.cpp: In function 'std::vector<int> coin_flips(std::vector<int>, int)':
coins.cpp:6:11: error: 'class std::vector<int>' has no member named 'pb'
    6 |     flips.pb(c);
      |           ^~
coins.cpp:7:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    7 |     for(int i=0; i<b.size(); i++) {
      |                  ~^~~~~~~~~
coins.cpp: In function 'int find_coin(std::vector<int>)':
coins.cpp:15:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   15 |     for(int i=0; i<b.size(); i++) {
      |                  ~^~~~~~~~~
coins.cpp:16:12: error: invalid types 'int[int]' for array subscript
   16 |         rez[0]^=b[i];
      |            ^