Submission #1235444

#TimeUsernameProblemLanguageResultExecution timeMemory
1235444diegoangulo5Coins (IOI17_coins)C++20
25 / 100
8 ms596 KiB
#include "coins.h"

#include <iostream>
using namespace std;

std::vector<int> coin_flips(std::vector<int> b, int c) {
    std::vector<int> flips;
    string a = "";
    a += char(b[0] + '0');
    a += char(b[1] + '0');
    a += char(b[2] + '0');
    if (c == 0) {
        if (a == "000" || a == "111") {
            flips.push_back(0);
        } else if (a == "001" || a == "110") {
            flips.push_back(1);
        } else if (a == "010" || a == "101") {
            flips.push_back(2);
        } else if (a == "011" || a == "100") {
            flips.push_back(7);
        }
    }
    if (c == 1) {
        if (a == "000" || a == "111") {
            flips.push_back(1);
        } else if (a == "001" || a == "110") {
            flips.push_back(0);
        } else if (a == "010" || a == "101") {
            flips.push_back(7);
        } else if (a == "011" || a == "100") {
            flips.push_back(2);
        }
    }
    if (c == 2) {
        if (a == "000" || a == "111") {
            flips.push_back(2);
        } else if (a == "001" || a == "110") {
            flips.push_back(7);
        } else if (a == "010" || a == "101") {
            flips.push_back(0);
        } else if (a == "011" || a == "100") {
            flips.push_back(1);
        }
    }
    if (c >= 3) {
        flips.push_back(7);
    }
    return flips;
}

int find_coin(std::vector<int> b) {
    if (b[0] != b[1] && b[0] != b[2]) {
        return 0;
    } else if (b[1] != b[0] && b[1] != b[2]) {
        return 1;
    } else if (b[2] != b[0] && b[2] != b[1]) {
        return 2;
    }
    return 7;
}
#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...