제출 #588530

#제출 시각아이디문제언어결과실행 시간메모리
588530Siffer저울 (IOI15_scales)C++14
71.43 / 100
1 ms212 KiB
#include "scales.h"
#include<bits/stdc++.h>
using namespace std;

void init(int T) {
    //
}

void orderCoins() {
    vector<int> W;
    int a = getLightest(1, 2, 3);
    int b = (a==1)?2:1;
    int c = (a==1)?3:2^3^a;
    int d = getHeaviest(b,c,4);
    if(d==4) {
        if(b==getNextLightest(a,b,d,c)) swap(b,c);
    } else {
        int k = d;
        d = 4;
        if(k==b) swap(d,b), swap(b,c);
        else swap(d,c);
        k = getNextLightest(a,b,d,c);
        if(k==a) swap(a,c);
        if(k!=d) swap(b,c);
    }
    int e = 5;
    int k = getNextLightest(a,b,c,5);
    if(k==a) {
        k = getMedian(a,d,e);
        if(k==e) swap(d,e);
        if(k==a) swap(a,e), swap(b,e), swap(c,e), swap(d,e);
    } else {
        if(k==b) swap(e,b);
        swap(e, c);
        swap(e, d);
    }
    int f = 6;
    k = getNextLightest(a,b,e,f);
    if(k==b) W = {a,f,b,c,d,e};
    else if(k==a) {
        k = getMedian(a,e,f);
        if(k==a) W = {f,a,b,c,d,e};
        else W = {a,b,c,d,e,f};
    }
    else if(k==e) {
        k = getMedian(c,d,f);
        if(k==c) W = {a,b,f,c,d,e};
        else if(k==f) W = {a,b,c,f,d,e};
        else W = {a,b,c,d,f,e};
    }
    //cout << W[0] << " " << W[1] << " " << W[2] << " " << W[3] << " " << W[4] << " " << W[5] << endl;
    int ANS[] = {W[0], W[1], W[2], W[3], W[4], W[5]};
    answer(ANS);
}

컴파일 시 표준 에러 (stderr) 메시지

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