제출 #765671

#제출 시각아이디문제언어결과실행 시간메모리
765671boyliguanhanScales (IOI15_scales)C++17
0 / 100
1 ms212 KiB
#include "scales.h"
#include <algorithm>
#define X std::swap(w1,w2),std::swap(p1,p2)
void init(int T) {}
void orderCoins() {
    int w[] = {0,0,0,0,0,0}, w1[] = {getLightest(1,2,3),getMedian(1,2,3),0}, w2[] = {getLightest(4,5,6),getMedian(4,5,6),0}, i;
	w1[2] = 6-w1[0]-w1[1], w2[2] = 15-w2[0]-w2[1];
    w[0] = getLightest(w1[0],w1[1],w2[0]);
    int p1 = w[0]==w1[0], p2 = !p1;
    if(p2) X;
    while(p1<3&&p2<3) {
        int x = getNextLightest(w1[0],w1[1],w1[2],w2[p2]);
        if(x==w1[0]) {
            while(p1<3)
                w[p1+p2] = w1[p1], p1++;
            while(p2<3)
                w[p1+p2] = w2[p2], p2++;
            break;
        }
        while(w1[p1]!=x)
            w[p1+p2] = w1[p1], p1++;
        w[p1+p2] = w2[p2], p2++;
        X;
    }
    answer(w);
}

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

scales.cpp: In function 'void init(int)':
scales.cpp:4:15: warning: unused parameter 'T' [-Wunused-parameter]
    4 | void init(int T) {}
      |           ~~~~^
scales.cpp: In function 'void orderCoins()':
scales.cpp:6:126: warning: unused variable 'i' [-Wunused-variable]
    6 |     int w[] = {0,0,0,0,0,0}, w1[] = {getLightest(1,2,3),getMedian(1,2,3),0}, w2[] = {getLightest(4,5,6),getMedian(4,5,6),0}, i;
      |                                                                                                                              ^
#Verdict Execution timeMemoryGrader output
Fetching results...