Submission #1242127

#TimeUsernameProblemLanguageResultExecution timeMemory
1242127KindaGoodGames저울 (IOI15_scales)C++20
33.33 / 100
1 ms328 KiB
#include "scales.h"
#include<bits/stdc++.h>

using namespace std;

void init(int T) {
    /* ... */
}

void orderCoins() {
    /* ... */
    int lo = getLightest(1,2,3);
    lo = getLightest(lo,4,5);
    if(lo != 5){
        lo = getLightest(lo,5,6); 
    }else{
        lo = getLightest(lo,4,6);  
    }

    int pt = 1;
    int ans[] = {lo,-1,-1,-1,-1,-1};

    set<int> left;
    for(int i = 1; i <= 6; i++){
        left.insert(i);
    }
    left.erase(lo);
    for(int k = 0; k < 3; k++){

        vector<int> notLo;
        for(int i = 1; i <= 6; i++){
            if(i == lo) continue;
            notLo.push_back(i);
        }
        int nlo = -1;

        if(k <= 1){ 
            int nlo1 = getNextLightest(notLo[0],notLo[1],notLo[2],lo);  
            int nlo2 = getNextLightest(notLo[3],notLo[4],notLo[0],lo);
            if(nlo1 == nlo2){
                nlo = nlo1;
            }else{
                nlo = getMedian(lo,nlo1,nlo2);
            }
        }else{
            vector<int> q;
            for(int i = 0; i < 6; i++){
                if(left.count(i+1)){
                    q.push_back(i+1);
                }
            }
            nlo = getLightest(q[0],q[1],q[2]);
        }

        lo = nlo;
        ans[pt++] = lo;
        left.erase(lo);
    }
    int f = getMedian(ans[0], *left.begin(), *left.rbegin());
    ans[4] = f;
    left.erase(f);
    ans[5] = *left.begin();

    answer(ans);
}
#Verdict Execution timeMemoryGrader output
Fetching results...