Submission #284112

#TimeUsernameProblemLanguageResultExecution timeMemory
284112diegoangulo5Scales (IOI15_scales)C++14
55.56 / 100
1 ms372 KiB
#include "scales.h"
#include <bits/stdc++.h>

using namespace std;

vector<int>n;

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

int excluir(int a, int b, int x, int y, int z){
    if(a!=x && b!=x)return x;
    if(a!=y && b!=y)return y;
    return z;
}

int excluir(int a, int x, int y, int z){
    if(a!=x)return x;
    return y;
}

void quitar(int a){
    vector<int>::iterator it = n.begin();
    for(;it!=n.end();it++){
        if(*it == a){
            n.erase(it);
            return;
        }
    }
}

void orderCoins() {
    n.clear();
    for(int a=0;a<6;a++)n.push_back(a+1);
    int w[6] = {0,0,0,0,0,0};
    int a = getLightest(1,2,3);
    int b = getLightest(4,5,6);
    int c;
    w[0] = getLightest(a,b, excluir(a, 1, 2, 3));
    quitar(w[0]);
    if(w[0] == a){
        c = excluir(a, 1, 2, 3);
        w[1] = getLightest(b, c, excluir(a, c, 1, 2, 3));
    }
    if(w[0] == b){
        c = excluir(b, 4, 5, 6);
        w[1] = getLightest(a, c, excluir(b, c, 4, 5, 6));
    }
    quitar(w[1]);
    a = getLightest(n[0], n[1], n[2]);
    w[2] = getLightest(a, n[3], excluir(a, n[3], n[0], n[1], n[2]));
    quitar(w[2]);
    if(a!=w[2]){
        w[3] = a;
    }
    else w[3] = getLightest(n[0], n[1], n[2]);
    w[4] = getMedian(n[0], n[1], n[2]);
    quitar(w[3]);
    quitar(w[4]);
    w[5] = n[0];
    answer(w);
}

Compilation message (stderr)

scales.cpp: In function 'void init(int)':
scales.cpp:8:15: warning: unused parameter 'T' [-Wunused-parameter]
    8 | void init(int T) {
      |           ~~~~^
scales.cpp: In function 'int excluir(int, int, int, int)':
scales.cpp:18:38: warning: unused parameter 'z' [-Wunused-parameter]
   18 | int excluir(int a, int x, int y, int z){
      |                                  ~~~~^
#Verdict Execution timeMemoryGrader output
Fetching results...