Submission #120191

# Submission time Handle Problem Language Result Execution time Memory
120191 2019-06-23T17:04:10 Z keko37 Scales (IOI15_scales) C++14
55.5556 / 100
2 ms 384 KB
#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);
}

Compilation message

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 time Memory Grader output
1 Partially correct 2 ms 384 KB Output is partially correct
2 Partially correct 2 ms 384 KB Output is partially correct
3 Partially correct 2 ms 384 KB Output is partially correct
4 Partially correct 2 ms 384 KB Output is partially correct
5 Partially correct 2 ms 384 KB Output is partially correct
6 Partially correct 2 ms 384 KB Output is partially correct
7 Partially correct 2 ms 384 KB Output is partially correct
8 Partially correct 2 ms 384 KB Output is partially correct
9 Partially correct 2 ms 384 KB Output is partially correct
10 Partially correct 2 ms 256 KB Output is partially correct
11 Partially correct 2 ms 384 KB Output is partially correct
12 Partially correct 2 ms 384 KB Output is partially correct
13 Partially correct 2 ms 384 KB Output is partially correct
14 Partially correct 2 ms 384 KB Output is partially correct
15 Partially correct 2 ms 384 KB Output is partially correct
16 Partially correct 2 ms 256 KB Output is partially correct
17 Partially correct 2 ms 256 KB Output is partially correct
18 Partially correct 2 ms 256 KB Output is partially correct
19 Partially correct 2 ms 256 KB Output is partially correct
20 Partially correct 2 ms 256 KB Output is partially correct
21 Partially correct 2 ms 256 KB Output is partially correct
22 Partially correct 2 ms 384 KB Output is partially correct
23 Partially correct 2 ms 256 KB Output is partially correct
24 Partially correct 2 ms 384 KB Output is partially correct
25 Partially correct 2 ms 384 KB Output is partially correct
26 Partially correct 2 ms 256 KB Output is partially correct
27 Partially correct 2 ms 384 KB Output is partially correct
28 Partially correct 2 ms 256 KB Output is partially correct
29 Partially correct 2 ms 384 KB Output is partially correct
30 Partially correct 2 ms 256 KB Output is partially correct
31 Partially correct 2 ms 384 KB Output is partially correct
32 Partially correct 2 ms 256 KB Output is partially correct
33 Partially correct 2 ms 384 KB Output is partially correct
34 Partially correct 2 ms 384 KB Output is partially correct
35 Partially correct 2 ms 384 KB Output is partially correct
36 Partially correct 2 ms 256 KB Output is partially correct
37 Partially correct 2 ms 384 KB Output is partially correct
38 Partially correct 2 ms 384 KB Output is partially correct
39 Partially correct 2 ms 384 KB Output is partially correct
40 Partially correct 2 ms 256 KB Output is partially correct