제출 #385194

#제출 시각아이디문제언어결과실행 시간메모리
385194victoriadCoins (IOI17_coins)C++14
0 / 100
3 ms1252 KiB
#include "coins.h"
using namespace std;
vector<int> coin_flips(vector<int> b, int c) {
    vector<int>co;
    if(c<2){
        if(c==0){
            if(b[50]==1)co.push_back(50);
            if(b[51]==1)co.push_back(51);
        }
        else{
            if(b[50]==1 && b[51]==1)co.push_back(51);
             if(b[50]==0 && b[51]==0)co.push_back(51);
        }
    
    }
    else{
        if(b[50]==0)co.push_back(50);
        if(b[51]==0)co.push_back(51);
    if(c>=32){
        if(b[5]==0)co.push_back(5);
        c-=32;
    }
    else {
        if(b[5]==1)co.push_back(5);
    }
    if(c>=16){
        if(b[4]==0)co.push_back(4);
        c-=16;
    }
    else {
        if(b[4]==1)co.push_back(4);
    }
    if(c>=8){
        if(b[3]==0)co.push_back(3);
        c-=8;
    }
    else {
        if(b[3]==1)co.push_back(3);
    }
    if(c>=4){
        if(b[2]==0)co.push_back(2);
        c-=4;
    }
    else {
        if(b[2]==1)co.push_back(2);
    }
    if(c>=2){
        if(b[1]==0)co.push_back(1);
        c-=2;
    }
    else {
        if(b[1]==1)co.push_back(1);
    }
    if(c>=1){
        if(b[0]==0)co.push_back(0);
        c-=1;
    }
    else {
        if(b[0]==1)co.push_back(0);
    }
    if(co.empty()){
        co.push_back(63);
    }
    }
    return co;
}

int find_coin(vector<int> b) {
    int x=0;
    int y=b[50]+b[51];
    if(y==2){
    if (b[0] == 1) {
        x=1;
    }
    if (b[1] == 1) {
        x+=2;
    }
    if (b[2] == 1) {
        x+=4;
    }
    if (b[3] == 1) {
        x+=8;
    }
    if (b[4] == 1) {
        x+=16;
    }
    if (b[5] == 1) {
        x+=32;
    }

    return x;
    }
    else{
        return y;
    }
}
#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...