Submission #720733

#TimeUsernameProblemLanguageResultExecution timeMemory
720733PenguinsAreCuteScales (IOI15_scales)C++17
45.45 / 100
1 ms340 KiB
#include "scales.h"
#include <bits/stdc++.h>
using namespace std;
void init(int T) {}

void orderCoins() {
    int A[3], B[3], heavy;
    A[0] = getLightest(1,2,3);
    A[1] = getMedian(1,2,3);
    A[2] = 6 - A[0] - A[1];
    B[0] = getLightest(4,5,6);
    B[1] = getMedian(4,5,6);
    B[2] = 15 - B[0] - B[1];
    heavy = getHeaviest(A[0], A[2], B[2]);
    int lptr = 0, rptr = 0;
    int W[6];
    for(int i = 0; i < 6; i++) {
        if(lptr == 3) {
            W[i] = B[rptr];
            rptr++;
        } else if(rptr == 3) {
            W[i] = A[lptr];
            lptr++;
        } else if(A[lptr] == heavy) {
            W[i] = B[rptr];
            rptr++;
        } else if(B[rptr] == heavy) {
            W[i] = A[lptr];
            lptr++;
        } else if(getLightest(heavy, A[lptr], B[rptr]) == A[lptr]) {
            W[i] = A[lptr];
            lptr++;
        } else {
            W[i] = B[rptr];
            rptr++;
        }
    }
    answer(W);
}

Compilation message (stderr)

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