# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
934122 |
2024-02-26T20:09:57 Z |
guymmk |
Coins (IOI17_coins) |
C++14 |
|
2 ms |
1124 KB |
#include <string>
#include <algorithm>
#include "coins.h"
using namespace std;
vector<int> coin_flips(vector<int> a,int c){
string bit="";
if (c == 0) bit="0";
while (c > 0) {
if (c%2==0) bit += '0';
else bit += '1';
c = c >> 1;
}
reverse(bit.begin(), bit.end());
reverse(bit.begin(),bit.end());
vector<int>res;
while(bit.size()!=6)bit='0'+bit;
for(int i=0;i<6;i++){
if(bit[i]-'0'!=a[i])res.push_back(i);
}
return res;
}
int find_coin(vector<int>a){
string s;
for(int i=0;i<6;i++)s+=(char)(a[i]+'0');
int x = 0;
reverse(s.begin(), s.end());
int cur_pow = 1;
for (int i = 0 ; i < (int)s.size() ; i++, cur_pow *= 2) {
x += cur_pow * (s[i] == '1');
}
return x;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
1116 KB |
WA in grader: invalid flips length |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
1116 KB |
WA in grader: invalid flips length |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
1108 KB |
WA in grader: invalid flips length |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
1124 KB |
WA in grader: invalid flips length |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
1116 KB |
WA in grader: invalid flips length |
2 |
Halted |
0 ms |
0 KB |
- |