Submission #385266

#TimeUsernameProblemLanguageResultExecution timeMemory
385266IwanttobreakfreeCoins (IOI17_coins)C++17
0 / 100
11 ms1600 KiB
#include "coins.h" #include <vector> using namespace std; vector<int> coin_flips(vector<int> b, int c) { vector<int> v(8); vector<int> flips; v[0]=1; for(int i=1;i<8;i++)v[i]=2*v[i-1]; if(c<2){ if(c==0){ if(b[0]==0)flips.push_back(0); } if(c==1){ if(b[0]==1)flips.push_back(0); else if(v[1]==0)flips.push_back(1); } } if(c>2){ vector<int> pos(8); for(int i=7;i>=0;i--){ if(v[i]<=c){ pos[7-i]=1; c-=v[i]; } else pos[7-i]=0; if(b[7-i]!=pos[7-i])flips.push_back(7-i); } } if(flips.size()==0)flips.push_back(63); return flips; } int find_coin(vector<int> b) { if(b[0]==1)return 0; if(b[1]==1)return 1; int sol=0; vector<int> v(8); v[0]=1; for(int i=1;i<8;i++)v[i]=2*v[i-1]; for(int i=0;i<8;i++){ if(i==1)sol+=v[7-i]; } return sol-1; }
#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...