Submission #415195

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

void orderCoins() {
    vector<bool>co(7,false);
    int ANS[6];
    int g1[3];
    int a=getLightest(1,2,3);
    g1[0]=a;
    co[a]=true;
    a=getMedian(1,2,3);
    g1[1]=a;
    co[a]=true;
    for(int i=1;i<4;i++)if(!co[i])g1[2]=i;
    int g2[3];
     a=getLightest(4,5,6);
    g2[0]=a;
    co[a]=true;
    a=getMedian(4,5,6);
    g2[1]=a;
    co[a]=true;
    for(int i=4;i<7;i++)if(!co[i])g2[2]=i;
    co.assign(7,false);
    int x1=0,x2=0;
    while(x1<3 && x2<3){
    if(x1!=2){
    int l=getLightest(g1[x1],g1[x1+1],g2[x2]);
    ANS[x1+x2]=l;
    if(l<=3)x1++;
    else x2++;
    }
    else if(x2!=2){
        int l=getLightest(g1[x1],g2[x2+1],g2[x2]);
        ANS[x1+x2]=l;
        if(l<=3)x1++;
        else x2++;
    }
    else{
        int l=getHeaviest(g1[2],g2[2],g1[0]);
        ANS[5]=l;
        if(l==g1[2])ANS[4]=g2[2];
        else ANS[4]=g1[2];
        x1++;
        x2++;
    }
    
    }
    if(x1<3){
        for(int i=x1;i<3;i++){
            ANS[i+2]=g1[i];
        }
    }
    if(x2<3){
        for(int i=x2;i<3;i++){
            ANS[i+2]=g2[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...