Submission #385256

#TimeUsernameProblemLanguageResultExecution timeMemory
385256IwanttobreakfreeCoins (IOI17_coins)C++17
0 / 100
11 ms1788 KiB
#include "coins.h" #include <vector> using namespace std; vector<int> coin_flips(vector<int> b, int c) { vector<int> flips; int n=b.size(); if(n==1)flips.push_back(0); 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_back(0); else flips.push_back(1); } if(c==1){ if(b[0]==0&&b[1]==0)flips.push_back(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 'int find_coin(std::vector<int>)':
coins.cpp:56:1: warning: control reaches end of non-void function [-Wreturn-type]
   56 | }
      | ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...