Submission #1078456

#TimeUsernameProblemLanguageResultExecution timeMemory
1078456ALeonidouScales (IOI15_scales)C++17
0 / 100
1 ms604 KiB
#include "scales.h"
#include <bits/stdc++.h>

using namespace std;

#define ll int
#define sz(x) (ll)x.size()
#define F first
#define S second
#define pb push_back

typedef vector <ll> vi;
typedef pair <ll,ll> ii;
typedef vector <ii> vii;

#define dbg(x) cout<<#x<<": "<<x<<endl;
#define dbg2(x,y) cout<<#x<<": "<<x<<" "<<#y<<": "<<y<<endl;
#define dbg3(x,y,z) cout<<#x<<": "<<x<<" "<<#y<<": "<<y<<" "<<#z<<": "<<z<<endl;

ll ttt = 0;
void init(int T) {
    ttt = T;
    return;
}

vi v;
void rem(ll idx){
    for (ll i =0; i<sz(v); i++){
        if (v[i] == idx){
            v.erase(v.begin() + i);
            return;
        }
    }
}

void orderCoins() {
    
    int ans[6];

    //find lightest of 6
    ll x = getLightest(1,getLightest(2,3,4),getLightest(4,5,6));
    
    v = {1,2,3,4,5,6};
    rem(x);

    ll y = getLightest(v[0], v[1], getLightest(v[2], v[3], v[4]));
    rem(y);

    ll z = getLightest(v[0], v[1], getLightest(v[1], v[2], v[3]));
    rem(z);

    ll w = getLightest(v[0], v[1], v[2]);
    rem(w);

    ll t = getMedian(v[0], v[1], x);
    rem(t);

    ll e = v[0];

    ans[0] = x;
    ans[1] = y;
    ans[2] = z;
    ans[3] = w;
    ans[4] = t;
    ans[5] = e;

    answer(ans);
}
#Verdict Execution timeMemoryGrader output
Fetching results...