Submission #793126

#TimeUsernameProblemLanguageResultExecution timeMemory
793126PixelCatScales (IOI15_scales)C++14
45.45 / 100
1 ms300 KiB
#ifdef NYAOWO
#include "grader.cpp"
#endif

#include "scales.h"

#include <bits/stdc++.h>
#define For(i, a, b) for(int i = a; i <= b; i++)
#define Forr(i, a, b) for(int i = a; i >= b; i--)
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define sz(x) ((int)x.size())
#define eb emplace_back
using namespace std;
using LL = long long;
using pii = pair<int, int>;

void init(int T) {
    /* ... */
    assert(T < 20);
}

void orderCoins() {
    /* ... */
    int W[] = {1, 2, 3, 4, 5, 6};

    For(i, 2, 5) {
        int mx = getHeaviest(W[0], W[1], W[i]);
        if(W[0] == mx) swap(W[0], W[i]);
        if(W[1] == mx) swap(W[1], W[i]);
    }
    For(i, 4, 5) {
        int mx = getHeaviest(W[2], W[3], W[i]);
        if(W[2] == mx) swap(W[2], W[i]);
        if(W[3] == mx) swap(W[3], W[i]);
    }

    int x;
    x = getLightest(W[0], W[1], W[2]);
    if(W[1] == x) swap(W[0], W[1]);
    x = getLightest(W[2], W[3], W[4]);
    if(W[3] == x) swap(W[2], W[3]);
    x = getHeaviest(W[3], W[4], W[5]);
    if(W[4] == x) swap(W[4], W[5]);

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