Submission #1378870

#TimeUsernameProblemLanguageResultExecution timeMemory
1378870danirasillaScales (IOI15_scales)C++20
55.56 / 100
1 ms412 KiB
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include "scales.h"

using namespace std;
typedef long long ll;

const ll e9 = 1e9;
int w[6];
/*
int getLightest(int a, int b, int c) {
    cout << "1 " << a << " " << b << " " << c << endl;
    int v;
    cin >> v;
    return v;
}
int getHeaviest(int a, int b, int c) {
    cout << "2 " << a << " " << b << " " << c << endl;
    int v;
    cin >> v;
    return v;
}
int getMedian(int a, int b, int c) {
    cout << "3 " << a << " " << b << " " << c << endl;
    int v;
    cin >> v;
    return v;
}
int getNextLightest(int a, int b, int c, int d) {
    cout << "4 " << a << " " << b << " " << c << "  " << d << endl;
    int v;
    cin >> v;
    return v;
}
void answer(int p[]) {
    for (int i = 0; i < 6; i++)
        cout << p[i] << " ";
}
*/
void init(int t) { return; }

void orderCoins()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    int t = 1;
    //cin >> t;
    while (t--) {
        int a[6];
        a[0] = getLightest(1, 2, 3);
        a[1] = getMedian(1, 2, 3);
        a[2] = 6 - a[0] - a[1];
        a[3] = getLightest(4, 5, 6);
        a[4] = getMedian(4, 5, 6);
        int gr = 3;
        a[5] = 15 - a[4] - a[3];
        if (getHeaviest(a[2], a[5], a[1]) == a[2]) {
            gr = 0;
        }
        w[0] = a[gr];
        w[1] = a[gr + 1];
        w[2] = a[gr + 2];
        int ans[3];
        for (int i = 0; i < 3; i++) {
            ans[i] = getNextLightest(1 + gr, 2 + gr, 3 + gr, a[i + 3 - gr]);
                int j = 0;
                while (w[j] != ans[i])
                    j++;
                for (int i = 5; i > j; i--)
                    w[i] = w[i - 1];
                w[j] = a[i + 3 - gr];
        }
    }
    answer(w);
}
#Result Execution timeMemoryGrader output
Fetching results...