제출 #394440

#제출 시각아이디문제언어결과실행 시간메모리
394440rainboyScales (IOI15_scales)C11
33.33 / 100
1 ms284 KiB
#include "scales.h"

void init(int T) {}

void orderCoins() {
	static int aa[6];
	int i, j, tmp;

	for (i = 0; i < 6; i++)
		aa[i] = i + 1;
	for (i = 0; i <= 3; i++) {
		int a, b, j_, tmp;

		a = getLightest(aa[i], aa[i + 1], aa[i + 2]), b = a == aa[i] ? aa[i + 1] : aa[i];
		if (a == aa[i])
			j_ = i;
		else if (a == aa[i + 1])
			j_ = i + 1;
		else
			j_ = i + 2;
		for (j = i + 3; j < 6; j++)
			if (getLightest(a, b, aa[j]) == aa[j])
				a = aa[j], j_ = j;
		tmp = aa[i], aa[i] = aa[j_], aa[j_] = tmp;
	}
	if (getHeaviest(aa[3], aa[4], aa[5]) == aa[4])
		tmp = aa[4], aa[4] = aa[5], aa[5] = tmp;
	answer(aa);
}

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

scales.c: In function 'init':
scales.c:3:15: warning: unused parameter 'T' [-Wunused-parameter]
    3 | void init(int T) {}
      |           ~~~~^
scales.c: In function 'orderCoins':
scales.c:12:17: warning: declaration of 'tmp' shadows a previous local [-Wshadow]
   12 |   int a, b, j_, tmp;
      |                 ^~~
scales.c:7:12: note: shadowed declaration is here
    7 |  int i, j, tmp;
      |            ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...