Submission #587339

#TimeUsernameProblemLanguageResultExecution timeMemory
587339LucppScales (IOI15_scales)C++17
55.56 / 100
1 ms304 KiB
#include "scales.h"
#include <bits/stdc++.h>
using namespace std;

void init(int T) {}

void orderCoins() {
    vector<int> v(3);
    v[0] = getLightest(1, 2, 3);
    v[2] = getHeaviest(1, 2, 3);
    v[1] = 6-v[0]-v[2];
    for(int i = 4; i <= 6; i++){
        int m = getMedian(v[1], v[2], i);
        if(m == i) v.insert(v.begin()+2, i);
        else if(m == v[1]){
            m = getMedian(v[0], v[1], i);
            if(m == v[0]) v.insert(v.begin(), i);
            else v.insert(v.begin()+1, i);
        }
        else{
            m = getMedian(v[i-3], v[i-2], i);
            if(m == i) v.insert(v.begin()+i-2, i);
            else if(m == v[i-3]) v.insert(v.begin()+i-3, i);
            else v.insert(v.begin()+i-1, i);
        }
    }
    answer(v.data());
}

Compilation message (stderr)

scales.cpp: In function 'void init(int)':
scales.cpp:5:15: warning: unused parameter 'T' [-Wunused-parameter]
    5 | void init(int T) {}
      |           ~~~~^
#Verdict Execution timeMemoryGrader output
Fetching results...