Submission #793543

#TimeUsernameProblemLanguageResultExecution timeMemory
793543Username4132Scales (IOI15_scales)C++14
45.45 / 100
1 ms276 KiB
#include "scales.h"
#include<vector>
#include<iostream>
using namespace std;
#define PB push_back
#define forn(i, n) for(int i=0; i<(int)n; ++i)

vector<int> order3(vector<int> v){
    int a = getLightest(v[0], v[1], v[2]);
    int b = getMedian(v[0], v[1], v[2]);
    int c = ((v[0]==a || v[0]==b)? ((v[1]==a || v[1]==b)? v[2] : v[1] ) : v[0]);
    return {a, b, c};
}

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

void orderCoins() {
    /* ... */
    int cnt=4;
    vector<int> v1 = order3({1, 2, 3}), v2 = order3({4, 5, 6}), ret;
    int i=0, j=0;
    while(i<3 && j<3){
        bool res;
        ++cnt;
        if(i<2) res=(getLightest(v1[i], v1[i+1], v2[j])==v1[i]);
        else res=(getHeaviest(v1[i], v1[i-1], v2[j])==v2[j]);
        if(res) ret.PB(v1[i++]);
        else ret.PB(v2[j++]);
    }
    while(i<3) ret.PB(v1[i++]);
    while(j<3) ret.PB(v2[j++]);

    while(cnt<9) getLightest(1, 2, 3), ++cnt;

    int W[6];
    forn(ind, 6) W[ind]=ret[ind];
    answer(W);
}

Compilation message (stderr)

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