Submission #385255

#TimeUsernameProblemLanguageResultExecution timeMemory
385255IwanttobreakfreeCoins (IOI17_coins)C++17
Compilation error
0 ms0 KiB
#include "coins.h" #include <vector> using namespace std; vector<int> coin_flips(vector<int> b, int c) { vector<int> flips; if(n==2){ if(c==0){ if(b[0]==1&&b[1]==0)flips.push_back(0); else if(b[0]==1&&b[1]==1)flips.push_back(0); } else{ if(b[0]==0&&b[1]==0)flips.push_back(0); else if(b[0]==0&&b[1]==1)flips.push_back(0); } } if(n==3){ if(c==0){ if(b[0]==1)flips.push_pack(0); else flips.push_pack(1); } if(c==1){ if(b[0]==0&&b[1]==0)flips.push_pack(0); else if(b[1]==0)flips.push_back(2); else if(b[1]==1)flips.push_back(1); } if(c==2){ } } if(n>3){ for(int i=0;i<n;i++){ if(b[i]==1)flips.push_back(i); } if(b[c]==0)flips.push_back(c); } return flips; } int find_coin(vector<int> b) { int n=b.size(); if(n==1)return 0; if(n==2){ if(b[0]==0)return 0; else return 1; } if(n==3){ if(b[0]==0)return 0; if(b[1]==0)return 1; return 2; } if(n>3){ for(int i=0;i<n;i++)if(b[i]==1)return i; } }

Compilation message (stderr)

coins.cpp: In function 'std::vector<int> coin_flips(std::vector<int>, int)':
coins.cpp:6:8: error: 'n' was not declared in this scope
    6 |     if(n==2){
      |        ^
coins.cpp:16:5: error: 'n' was not declared in this scope
   16 |  if(n==3){
      |     ^
coins.cpp:18:21: error: 'class std::vector<int>' has no member named 'push_pack'; did you mean 'push_back'?
   18 |    if(b[0]==1)flips.push_pack(0);
      |                     ^~~~~~~~~
      |                     push_back
coins.cpp:19:15: error: 'class std::vector<int>' has no member named 'push_pack'; did you mean 'push_back'?
   19 |    else flips.push_pack(1);
      |               ^~~~~~~~~
      |               push_back
coins.cpp:22:30: error: 'class std::vector<int>' has no member named 'push_pack'; did you mean 'push_back'?
   22 |    if(b[0]==0&&b[1]==0)flips.push_pack(0);
      |                              ^~~~~~~~~
      |                              push_back
coins.cpp:30:5: error: 'n' was not declared in this scope
   30 |  if(n>3){
      |     ^
coins.cpp: In function 'int find_coin(std::vector<int>)':
coins.cpp:54:1: warning: control reaches end of non-void function [-Wreturn-type]
   54 | }
      | ^