제출 #588407

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

void init(int T) {
    //
}

void orderCoins() {
    int W[] = {1, 2, 3, 4, 5, 6};
    int a = getLightest(1,2,3);
    int b = getLightest(4, 5, 6);
    W[0] = getLightest(a, b, (a^1)?1:2);
    //if(W[0]==a) cout << a << " " << b << " " << ((a^1)?1:2) << " " << ((a^1)?2^3^a:3) << endl;
    //else        cout << b << " " << a << " " << ((b^4)?4:5) << " " << ((b^4)?5^6^b:6) << endl;
    if(W[0]==a) W[1] = getLightest(b,(a^1)?1:2,(a^1)?2^3^a:3);
    else W[1] = getLightest(a,(b^4)?4:5,(b^4)?5^6^b:6);
    vector<int> o = {1,2,3,4,5,6,W[0],W[1]};
    sort(o.begin(), o.end());
    for(int i = 0; i < 7; i++) {
        if(o[i]==o[i+1]) {
            o[i] = 10;
            o[++i] = 10;
        }
    }
    sort(o.begin(), o.end());
    W[2] = getLightest(o[0], o[1], o[2]);
    W[2] = getHeaviest(o[3], W[2], W[0])^o[3]^W[2];
    o.push_back(W[2]);
    sort(o.begin(), o.end());
    for(int i = 0; i < 7; i++) {
        if(o[i]==o[i+1]) {
            o[i] = 10;
            o[++i] = 10;
        }
    }
    sort(o.begin(), o.end());
    W[3] = getLightest(o[0], o[1], o[2]);
    W[4] = getMedian(o[0], o[1], o[2]);
    W[5] = o[0]^o[1]^o[2]^W[3]^W[4];
    answer(W);
}

컴파일 시 표준 에러 (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...