Submission #387451

#TimeUsernameProblemLanguageResultExecution timeMemory
387451AmineTrabelsi저울 (IOI15_scales)C++14
0 / 100
2 ms492 KiB
#include <bits/stdc++.h>
#include "scales.h"
using namespace std;
void init(int T) {
    //cout << T<<'\n';
    while(T--){
        orderCoins();
    }
}

void orderCoins() {
    /* 
    getHeaviest();
    getLightest();
    getMedian();
    getNextLightest();
    */
    int W[] = {0,0,0,0,0,0};
    int light = 1;
    for(int i=2;i<6;i++){
        if(light != i)
        light = getLightest(light,i,i+1);
    }
    W[0] = light;
    set<int> left = {1,2,3,4,5,6};
    left.erase(light);
    for(int i=1;i<4;i++){
        for(auto a:left)for(auto b:left){
            if(a == b)continue;
            for(auto c:left){
                if(c == a || c == b)continue;
                light = getNextLightest(a,b,c,W[i-1]);
            }
        }
        W[i] = light;
        left.erase(light);
    }
    int x = *(left.begin()),y = *(++left.begin());
    W[4] = getMedian(W[3],x,y);
    left.erase(W[4]);
    W[5] = *(left.begin());
    answer(W);
}
#Verdict Execution timeMemoryGrader output
Fetching results...