Submission #594052

#TimeUsernameProblemLanguageResultExecution timeMemory
594052shezittCoins (IOI17_coins)C++14
25 / 100
9 ms1540 KiB
#include "coins.h" #include <bits/stdc++.h> using namespace std; // subtask 4 vector<int> coin_flips(vector<int> b, int c) { vector<int> flips; string s; int cc = c; while(cc){ s = (char)(cc%2+'0') + s; cc /= 2; } while(int(s.size()) < 8){ s = '0' + s; } for(int i=0; i<8; ++i){ if(s[i] == '1' && !b[i]){ flips.push_back(i); } else if(s[i] == '0' && b[i]){ flips.push_back(i); } } if(int(flips.size()) == 0){ flips.push_back(63); } return flips; } int find_coin(vector<int> b) { int ans = 0; for(int i=7; i>=0; --i){ if(b[i]){ ans += 1<<(7-i); } } return ans; }
#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...