제출 #484757

#제출 시각아이디문제언어결과실행 시간메모리
484757imachug저울 (IOI15_scales)C++17
0 / 100
1 ms204 KiB
#include "scales.h"

#include <bits/stdc++.h>

using namespace std;


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


void order3(int a, int b, int c, int* w) {
	w[0] = getLightest(a, b, c);
	w[1] = getMedian(a, b, c);
	w[2] = a + b + c - w[0] - w[1];
}


void orderCoins() {
	int max1 = getHeaviest(1, 2, 3);

	// Is the first half strictly less than the right half?
	if(getNextLightest(4, 5, 6, max1) == getLightest(4, 5, 6)) {
		// Seems so. Order the two halves separately
		int W[6];
		order3(1, 2, 3, W);
		order3(4, 5, 6, W + 3);
		answer(W);
		return;
	}

	int max2 = getHeaviest(4, 5, 6);
	int max3 = max1 == 1 ? 2 : 1;
	int max = getHeaviest(max1, max2, max3);

	int W[] = {1, 2, 3, 4, 5, 6};
	swap(W[5], W[max - 1]);

	stable_sort(W, W + 5, [&](int i, int j) {
		return getLightest(i, j, max) == i;
	});

	answer(W);
}

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

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