Submission #778346

#TimeUsernameProblemLanguageResultExecution timeMemory
778346Jarif_RahmanScales (IOI15_scales)C++17
55.56 / 100
1 ms304 KiB
#include "scales.h"
#include <bits/stdc++.h>
#define pb push_back
#define f first
#define sc second
using namespace std;
typedef long long int ll;
typedef string str;

void init(int T){
}

void orderCoins(){
    int w[6] = {1, 2, 3, 4, 5, 6};
    w[0] = getLightest(1, 2, 3);
    w[2] = getHeaviest(1, 2, 3);
    w[1] = 6-w[0]-w[2];
    w[3] = getLightest(4, 5, 6);
    w[5] = getHeaviest(4, 5, 6);
    w[4] = 15-w[3]-w[5];

    if(getHeaviest(w[4], w[5], w[2]) == w[2]){
        swap(w[0], w[3]), swap(w[1], w[4]), swap(w[2], w[5]);
    }

    int v[6] = {0, 0, 0, 0, 0, 0};
    swap(w, v);

    int p = 0;
    int x = getNextLightest(v[3], v[4], v[5], v[0]);
    for(int i = 3; i < 6; i++){
        if(v[i] == x){
            x = i;
            break;
        }
        w[p++] = v[i];
    }
    w[p++] = v[0];

    int y = getNextLightest(v[3], v[4], v[5], v[1]);
    for(int i = x; i < 6; i++){
        if(v[i] == y){
            y = i;
            break;
        }
        w[p++] = v[i];
    }
    w[p++] = v[1];

    int z = getNextLightest(v[3], v[4], v[5], v[2]);
    for(int i = y; i < 6; i++){
        if(v[i] == z){
            z = i;
            break;
        }
        w[p++] = v[i];
    }
    w[p++] = v[2];

    for(int i = z; i < 6; i++) w[p++] = v[i];
    answer(w);
}

Compilation message (stderr)

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