제출 #1214680

#제출 시각아이디문제언어결과실행 시간메모리
1214680Captain_Georgia저울 (IOI15_scales)C++20
45.45 / 100
0 ms328 KiB
#include "scales.h"

#include <bits/stdc++.h>
using namespace std;

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

void orderCoins () {
    int res[6];
    int f[2][3];
    f[0][0] = getLightest(1, 2, 3);
    f[0][1] = getMedian(1, 2, 3);
    f[0][2] = 6 - f[0][0] - f[0][1];
    f[1][0] = getLightest(4, 5, 6);
    f[1][1] = getMedian(4, 5, 6);
    f[1][2] = 15 - f[1][0] - f[1][1];
    // cerr << f[0][0] << " " << f[0][1] << " " << f[0][2] << "\n";
    // cerr << f[1][0] << " " << f[1][1] << " " << f[1][2] << "\n";

    int l1 = 0, r1 = 1, l2 = 0, r2 = 0;
    for (int i = 0;i < 3;i ++) {
        vector<int> tmp;
        for (int j = l1;j <= r1;j ++) tmp.push_back(f[0][j]);
        for (int j = l2;j <= r2;j ++) tmp.push_back(f[1][j]);
        int ind = getLightest(tmp[0], tmp[1], tmp[2]);
        if (ind == f[0][l1]) {
            res[i] = f[0][l1];
            l1 ++;
            if (r1 == 2) r2 ++;
            else r1 ++;
        } else {
            res[i] = f[1][l2];
            l2 ++;
            if (r2 == 2) r1 ++;
            else r2 ++;
        }
    }

    vector<int> tmp;
    for (int j = l1;j <= r1;j ++) tmp.push_back(f[0][j]);
    for (int j = l2;j <= r2;j ++) tmp.push_back(f[1][j]);
    res[3] = getLightest(tmp[0], tmp[1], tmp[2]);
    res[4] = getMedian(tmp[0], tmp[1], tmp[2]);
    res[5] = accumulate(tmp.begin(), tmp.end(), 0) - res[3] - res[4];

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