제출 #120191

#제출 시각아이디문제언어결과실행 시간메모리
120191keko37저울 (IOI15_scales)C++14
55.56 / 100
2 ms384 KiB
#include <bits/stdc++.h>
#include "scales.h"

using namespace std;

vector <int> sol;

void init(int T) {
}

vector <int> f (int a, int b, int c) {
	int mn, med, mx;
	mn = getLightest(a, b, c);
	mx = getHeaviest(a, b, c);
	if (a != mn && a != mx) med = a;
	if (b != mn && b != mx) med = b;
	if (c != mn && c != mx) med = c;
	return {mn, med, mx};
}

void orderCoins() {
	sol.clear();
	vector <int> v1 = f(1, 2, 3);
	vector <int> v2 = f(4, 5, 6);
	int mn = getLightest(v1[0], v1[1], v2[0]);
	if (v2[0] == mn) swap(v1, v2);
	vector <int> n1, n2, n3;
	for (int i=0; i<3; i++) {
		int ind = getNextLightest(v1[0], v1[1], v1[2], v2[i]);
		if (ind == v1[0]) {
			n3.push_back(v2[i]);
		} else if (ind == v1[1]) {
			n1.push_back(v2[i]);
		} else {
			n2.push_back(v2[i]);
		}
	}
	sol.push_back(v1[0]);
	for (auto x : n1) sol.push_back(x);
	sol.push_back(v1[1]);
	for (auto x : n2) sol.push_back(x);
	sol.push_back(v1[2]);
	for (auto x : n3) sol.push_back(x);
	int A[] = {sol[0], sol[1], sol[2], sol[3], sol[4], sol[5]};
	answer(A);
}

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

In file included from grader.c:2:0:
graderlib.c: In function 'void answer(int*)':
graderlib.c:53:5: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
     if (_ghksjhdfkae19ga_ > 1) 
     ^~
graderlib.c:56:2: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
  for (i = 0; i < 6; i++) {
  ^~~
scales.cpp: In function 'void init(int)':
scales.cpp:8:15: warning: unused parameter 'T' [-Wunused-parameter]
 void init(int T) {
               ^
scales.cpp: In function 'std::vector<int> f(int, int, int)':
scales.cpp:18:21: warning: 'med' may be used uninitialized in this function [-Wmaybe-uninitialized]
  return {mn, med, mx};
                     ^
#Verdict Execution timeMemoryGrader output
Fetching results...