Submission #1121010

#TimeUsernameProblemLanguageResultExecution timeMemory
1121010SalihSahinScales (IOI15_scales)C++14
45.45 / 100
1 ms592 KiB
#include <bits/stdc++.h>
#define pb push_back
using namespace std;
#include "scales.h"

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

void orderCoins() {
    int W[6];
    int x = getLightest(1, 2, 3);
    int y = getHeaviest(1, 2, 3);
    vector<int> l = {x, 6 - (x + y), y};

    x = getLightest(4, 5, 6);
    y = getHeaviest(4, 5, 6);
    vector<int> r = {x, 15 - (x + y), y};

    int other = 1;
    while(other == l[2] || other == r[2]) other++;
    int mx = getHeaviest(l[2], r[2], other);

    int li = 0, ri = 0;
    for(int i = 0; i < 5; i++){
        if(li == 3 || mx == l[li]){
            W[i] = r[ri];
            ri++;
            continue;
        }
        if(ri == 3 || mx == r[ri]){
            W[i] = l[li];
            li++;
            continue;
        }

        int now = getLightest(l[li], r[ri], mx);
        W[i] = now;
        if(now == l[li]){
            li++;
        }
        else ri++;
    }
    W[5] = mx; 
    answer(W);
}

Compilation message (stderr)

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