Submission #1147981

#TimeUsernameProblemLanguageResultExecution timeMemory
1147981alexddScales (IOI15_scales)C++20
0 / 100
0 ms320 KiB
#include "scales.h"
#include<bits/stdc++.h>
using namespace std;

void init(int T)
{

}

vector<int> scoate(vector<int> v, int val)
{
    vector<int> newv;
    for(int x:v)
        if(x!=val)
            newv.push_back(x);
    return newv;
}
void pune(int newsol[], int sol[], int poz)
{
    for(int i=0;i<6;i++)
    {
        newsol[i] = sol[poz];
        poz++;
        if(poz==6) poz=0;
    }
}
void orderCoins()
{
    int sol[6];
    vector<int> ramase = {1,2,3,4,5,6};

    sol[0] = 1;
    ramase = scoate(ramase, sol[0]);

    int x = getNextLightest(ramase[0],ramase[1],ramase[2],sol[0]);
    x = getNextLightest(x,ramase[3],ramase[4],sol[0]);
    sol[1] = x;
    ramase = scoate(ramase, sol[1]);

    x = getNextLightest(ramase[0],ramase[1],ramase[2],sol[1]);
    x = getNextLightest(x,ramase[2],ramase[3],sol[1]);
    sol[2] = x;
    ramase = scoate(ramase, sol[2]);

    x = getNextLightest(ramase[0],ramase[1],ramase[2],sol[2]);
    sol[3] = x;
    ramase = scoate(ramase, sol[3]);

    x = getNextLightest(ramase[0],ramase[1],sol[2],sol[3]);
    assert(x!=sol[2]);
    sol[4] = x;
    ramase = scoate(ramase, sol[4]);

    assert((int)ramase.size()==1);
    sol[5] = ramase[0];

    int newsol[6];

    x = getLightest(sol[0],sol[1],sol[2]);
    if(x != sol[0])
    {
        if(x == sol[1])
        {
            pune(newsol,sol,1);
        }
        else
        {
            assert(x == sol[2]);
            pune(newsol,sol,2);
        }
    }
    else
    {
        x = getLightest(sol[3],sol[4],sol[5]);
        if(x == sol[3])
        {
            for(int i=0;i<6;i++)
                newsol[i] = sol[i];
        }
        else if(x == sol[4])
        {
            pune(newsol,sol,4);
        }
        else
        {
            assert(x == sol[5]);
            pune(newsol,sol,5);
        }
    }
    answer(newsol);
}
#Verdict Execution timeMemoryGrader output
Fetching results...