Submission #31256

#TimeUsernameProblemLanguageResultExecution timeMemory
31256top34051Scales (IOI15_scales)C++14
38.70 / 100
0 ms2024 KiB
#include "scales.h"
#include<bits/stdc++.h>
using namespace std;

int A[5], B[5], p[5];

void init(int T) {
}

void orderCoins() {
    int i,j,x,pos;
    int W[] = {1, 2, 3, 4, 5, 6};

    A[0] = getLightest(1,2,3);
    A[1] = getMedian(1,2,3);
    for(x=1;x<=3;x++) if(x!=A[0] && x!=A[1]) A[2] = x;

    B[0] = getLightest(4,5,6);
    B[1] = getMedian(4,5,6);
    for(x=4;x<=6;x++) if(x!=B[0] && x!=B[1]) B[2] = x;

    for(i=0;i<3;i++) {
        if(i && p[i-1]==-1) {
            p[i] = -1;
            continue;
        }
        p[i] = getNextLightest(A[0],A[1],A[2],B[i]);
        if(p[i]==A[0] && getLightest(A[0],A[1],B[i])!=B[i]) p[i] = -1;
    }

    pos = 0;
    for(i=j=0;i<3;i++) {
        while(j<3 && p[j]==A[i]) W[pos++] = B[j++];
        W[pos++] = A[i];
    }
    while(j<3) W[pos++] = B[j++];

//    for(i=0;i<6;i++) cerr << W[i] << " ";
//    cerr << endl;

    answer(W);
}

Compilation message (stderr)

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