Submission #125704

# Submission time Handle Problem Language Result Execution time Memory
125704 2019-07-06T09:07:14 Z SOIVIEONE Scales (IOI15_scales) C++14
45.4545 / 100
2 ms 380 KB
#include "scales.h"
void init(int T) {
}
	int x[5], y[5], w[6];
void orderCoins() {
	x[3] = getHeaviest(1, 2, 3); y[3] = getHeaviest(4, 5, 6);
	x[2] = getMedian(1, 2, 3); y[2] = getMedian(4, 5, 6);
	for(int i = 1; i <= 3; i ++)
		if(i != x[3] && i != x[2])
			x[1] = i;
	for(int i = 4; i <= 6; i ++)
		if(i != y[3] && i != y[2])
			y[1] = i;
	int a1 = getLightest(x[1], y[1], y[2]);
	int l = 1, r = 1;
	if(a1 == x[1])
		l ++;
	else
		r ++;
	w[0] = a1;
	a1 = getLightest(x[l], y[r], y[3]);
	if(a1 == x[l])
		w[1] = x[l],
		l ++;
	else
		w[1] = y[r],
		r ++;
	a1 = getLightest(x[l], y[r], (r == 3 ? x[3] : y[3]));
	if(a1 == x[l])
	{
		l ++;
	}
	else
	{
		r ++;
	}
	w[2] = a1;
	if(l > 3)
		a1 = getLightest(y[1], y[2], y[3]);
	else
	if(r > 3)
		a1 = getLightest(x[1], x[2], x[3]);
	else
	a1 = getLightest(x[l], y[r], (r == 3 ? x[3] : y[3]));
	w[3] = a1;
	if(a1 == x[l])
		l ++;
	else
		r ++;
	if(l > 3)
		a1 = getMedian(w[0], y[2], y[3]);
	else
	if(r > 3)
		a1 = getMedian(w[0], x[2], x[3]);
	else
		a1= getMedian(w[0], x[3], y[3]);
	w[4] = a1;
	for(int i = 1; i <= 6; i ++)
	{
		int flag = 0;
		for(int j = 0; j <= 4; j ++)
			if(w[j] == i)
			{
				flag = 1;
				break;
			}
		if(!flag)
		{
			w[5] = i;
			break;
		}
	}
	answer(w);
}

Compilation message

scales.cpp: In function 'void init(int)':
scales.cpp:2:15: warning: unused parameter 'T' [-Wunused-parameter]
 void init(int T) {
               ^
# Verdict Execution time Memory Grader output
1 Partially correct 2 ms 376 KB Output is partially correct
2 Partially correct 2 ms 256 KB Output is partially correct
3 Partially correct 2 ms 376 KB Output is partially correct
4 Partially correct 2 ms 256 KB Output is partially correct
5 Partially correct 2 ms 256 KB Output is partially correct
6 Partially correct 2 ms 256 KB Output is partially correct
7 Partially correct 2 ms 256 KB Output is partially correct
8 Partially correct 2 ms 376 KB Output is partially correct
9 Partially correct 2 ms 376 KB Output is partially correct
10 Partially correct 2 ms 376 KB Output is partially correct
11 Partially correct 2 ms 256 KB Output is partially correct
12 Partially correct 2 ms 380 KB Output is partially correct
13 Partially correct 2 ms 256 KB Output is partially correct
14 Partially correct 2 ms 256 KB Output is partially correct
15 Partially correct 2 ms 376 KB Output is partially correct
16 Partially correct 2 ms 256 KB Output is partially correct
17 Partially correct 2 ms 376 KB Output is partially correct
18 Partially correct 2 ms 376 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 256 KB Output is partially correct
23 Partially correct 2 ms 256 KB Output is partially correct
24 Partially correct 2 ms 256 KB Output is partially correct
25 Partially correct 2 ms 256 KB Output is partially correct
26 Partially correct 2 ms 256 KB Output is partially correct
27 Partially correct 2 ms 376 KB Output is partially correct
28 Partially correct 2 ms 380 KB Output is partially correct
29 Partially correct 2 ms 256 KB Output is partially correct
30 Partially correct 2 ms 376 KB Output is partially correct
31 Partially correct 2 ms 256 KB Output is partially correct
32 Partially correct 2 ms 376 KB Output is partially correct
33 Partially correct 2 ms 256 KB Output is partially correct
34 Partially correct 2 ms 376 KB Output is partially correct
35 Partially correct 2 ms 256 KB Output is partially correct
36 Partially correct 2 ms 376 KB Output is partially correct
37 Partially correct 2 ms 256 KB Output is partially correct
38 Partially correct 2 ms 376 KB Output is partially correct
39 Partially correct 2 ms 256 KB Output is partially correct
40 Partially correct 2 ms 256 KB Output is partially correct