Submission #415182

#TimeUsernameProblemLanguageResultExecution timeMemory
415182victoriadScales (IOI15_scales)C++14
45.45 / 100
2 ms280 KiB
#include "scales.h"
#include <vector>
using namespace std;
void init(int T) {
    /* ... */
}

void orderCoins() {
    vector<bool>co(7,false);
    int ANS[6];
    int l=getLightest(1,2,3);
    l=getLightest(l,4,5);
    if(l!=3)l=getLightest(3,l,6);
    else l=getLightest(l,4,6);
    ANS[0]=l;
    co[l]=true;
    int a=-1,b=-1,c=-1;
    for(int i=1;i<7;i++){
        if(!co[i]){
            if(a==-1)a=i;
            else if(b==-1)b=i;
            else if(c==-1){
                c=i;
                l=getLightest(a,b,c);
                break;
            }
        }
    }
    a=-1;
    b=-1;
    for(int i=c+1;i<7;i++){
        if(!co[i]){
            if(a==-1)a=i;
            else if(b==-1)b=i;
        }
    }
    l=getLightest(a,b,l);
    ANS[1]=l;
    co[l]=true;
     a=-1;
     b=-1;
     c=-1;
    for(int i=1;i<7;i++){
        if(!co[i]){
            if(a==-1)a=i;
            else if(b==-1)b=i;
            else if(c==-1){
                c=i;
                l=getLightest(a,b,c);
            }
            else{
                if(c!=l)
                l=getLightest(l,i,c);
                else l=getLightest(l,i,a);
            }
        }
    }
    ANS[2]=l;
    co[l]=true;
    a=-1;
     b=-1;
     c=-1;
    for(int i=1;i<7;i++){
        if(!co[i]){
            if(a==-1)a=i;
            else if(b==-1)b=i;
            else if(c==-1){
                c=i;
                l=getLightest(a,b,c);
                ANS[3]=l;
                co[l]=true;
                l=getMedian(a,b,c);
                ANS[4]=l;
                co[l]=true;
            }
        }
    }
    for(int i=1;i<7;i++){
        if(!co[i])ANS[5]=i;
    }

   answer(ANS);
}

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...