# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
385255 | Iwanttobreakfree | Coins (IOI17_coins) | C++17 | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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;
}
}