Submission #782833

#TimeUsernameProblemLanguageResultExecution timeMemory
782833fatemetmhrScales (IOI15_scales)C++17
55.56 / 100
1 ms232 KiB
//  ~ Be Name Khoda ~  //

#include "scales.h"
#include <bits/stdc++.h>
//#pragma GCC optimize ("O3")
//#pragma GCC target("avx2")
//#pragma GCC optimize("unroll-loops,Ofast")

using namespace std;

typedef long long ll;

#define pb       push_back
#define mp       make_pair
#define all(x)   x.begin(), x.end()
#define fi       first
#define se       second

const int maxn  =  1e6   + 10;
const int maxn5 =  5e5   + 10;
const int maxnt =  1.2e6 + 10;
const int maxn3 =  1e3   + 10;
const int mod   =  1e9   + 7;
const ll  inf   =  1e18;

/*
getHeaviest(), getLightest(), getMedian(), getNextLightest();
*/

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

void orderCoins() {
    vector <int> ret;
    int a[] = {1, 2, 3, 4, 5, 6};
    a[0] = getLightest(1, 2, 3);
    a[1] = getMedian(1, 2, 3);
    a[2] = (a[0] != 1 && a[1] != 1 ? 1 : (a[0] != 2 && a[1] != 2 ? 2 : 3));

    a[3] = getLightest(4, 5, 6);
    a[4] = getMedian(4, 5, 6);
    a[5] = (a[3] != 4 && a[4] != 4 ? 4 : (a[3] != 5 && a[4] != 5 ? 5 : 6));

    int x = getLightest(a[0], a[3], a[1]);
    if(x == a[0]){
        swap(a[0], a[3]);
        swap(a[1], a[4]);
        swap(a[2], a[5]);
    }

    x = getNextLightest(a[3], a[4], a[5], a[1]);

    if(x == a[3]){
        x = getNextLightest(a[3], a[4], a[5], a[0]);
        if(x == a[3])
            ret = {a[3], a[4], a[5], a[0], a[1], a[2]};
        else if(x == a[4])
            ret = {a[3], a[0], a[4], a[5], a[1], a[2]};
        else
            ret = {a[3], a[4], a[0], a[5], a[1], a[2]};
    }
    else if(x == a[4]){
        x = getNextLightest(a[3], a[4], a[5], a[2]);
        if(x == a[3])
            ret = {a[3], a[0], a[1], a[4], a[5], a[2]};
        else if(x == a[4])
            ret = {a[3], a[0], a[1], a[2], a[4], a[5]};
        else
            ret = {a[3], a[0], a[1], a[4], a[2], a[5]};
    }
    else if(x == a[5]){
        x = getLightest(a[0], a[4], a[5]);
        if(x == a[0]){
            x = getHeaviest(a[0], a[2], a[5]);
            if(x == a[2])
                ret = {a[3], a[0], a[4], a[1], a[5], a[2]};
            else
                ret = {a[3], a[0], a[4], a[1], a[2], a[5]};
        }
        else if(x == a[4]){
            x = getHeaviest(a[0], a[2], a[5]);
            if(x == a[2])
                ret = {a[3], a[4], a[0], a[1], a[5], a[2]};
            else
                ret = {a[3], a[4], a[0], a[1], a[2], a[5]};
        }
    }
    for(int i = 0; i < 6; i++)
        a[i] = ret[i];
    answer(a);
    return;
}

Compilation message (stderr)

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