Submission #1235453

#TimeUsernameProblemLanguageResultExecution timeMemory
1235453diegoangulo5Coins (IOI17_coins)C++20
25 / 100
5 ms584 KiB
#include "coins.h"

#include <iostream>
using namespace std;

std::vector<int> coin_flips(std::vector<int> b, int c) {
    vector<int> flips;
    for (int i = 0; i < 8; i++) {
        if (c % 2 != b[i]) {
            flips.push_back(i);
        }
        c /= 2;
    }
    if (flips.empty()) {
        flips.push_back(7);
        flips.push_back(7);
    }
    return flips;
}

int find_coin(std::vector<int> b) {
    int pos = 0;
    int power = 1;
    for (int i = 0; i < 8; i++) {
        if (b[i] == 1) {
            pos += power;
        }
        power *= 2;
    }
    return pos;
}
#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...