Submission #558577

#TimeUsernameProblemLanguageResultExecution timeMemory
558577n0sk1llScales (IOI15_scales)C++14
0 / 100
2 ms300 KiB
#include "scales.h"
#include <bits/stdc++.h>

using namespace std;
long long int typedef li;

int w[6];
int sta[6];

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

void merge()
{
    int p=0,q=3,r=0;
    while (true)
    {
        if (p==3)
        {
            if (q==6) break;
            sta[r++]=w[q++];
        }
        else if (q==6)
        {
            sta[r++]=w[p++];
        }
        else if (p==2)
        {
            int id=getHeaviest(w[p-1],w[p],w[q]);
            cout<<"heavy "<<w[p-1]<<" "<<w[p]<<" "<<w[q]<<": "<<id<<endl;
            if (id==w[p]) sta[r++]=w[q++];
            else sta[r++]=w[p++];
        }
        else
        {
            int id=getLightest(w[p],w[p+1],w[q]);
            cout<<"light "<<w[p]<<" "<<w[p+1]<<" "<<w[q]<<": "<<id<<endl;
            if (id==w[p]) sta[r++]=w[p++];
            else sta[r++]=w[q++];
        }
    }
}

void orderCoins()
{
    w[0]=getLightest(1,2,3);
    w[1]=getMedian(1,2,3);
    w[2]=getHeaviest(1,2,3);
    w[3]=getLightest(4,5,6);
    w[4]=getMedian(4,5,6);
    w[5]=getHeaviest(4,5,6);
    merge();

    answer(sta);
}

Compilation message (stderr)

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