Submission #58573

# Submission time Handle Problem Language Result Execution time Memory
58573 2018-07-18T08:46:14 Z ngkan146 Scales (IOI15_scales) C++11
55.5556 / 100
4 ms 668 KB
#include "scales.h"
#include <bits/stdc++.h>
using namespace std;

void init(int T) {
    /* do nothing */
}

void orderCoins() {
	int res[6];
	vector <int> lst;
	for(int i=1;i<=6;i++)	lst.push_back(i);
	
	int tmp;
	
	tmp = getLightest(lst[0], lst[1], lst[2]);
	if (tmp == lst[1])	swap(lst[0], lst[1]);
	else if (tmp == lst[2])	swap(lst[0], lst[2]);
	
	tmp = getLightest(lst[0], lst[3], lst[4]);
	if (tmp == lst[3])	swap(lst[0], lst[3]);
	else if (tmp == lst[4])	swap(lst[0], lst[4]);
	
	tmp = getMedian(lst[0], lst[2], lst[5]);	
	if (tmp == lst[0]) swap(lst[0], lst[5]), swap(lst[1], lst[5]); // lst[5] < lst[0] < lst[2]; 
	else if (tmp == lst[2])	swap(lst[1], lst[2]), swap(lst[2], lst[5]);	// lst[0] < lst[2] < lst[5]
	else if (tmp == lst[5])	swap(lst[1], lst[5]);	// lst[0] < lst[5] < lst[2]; 
	
	//after swap: lst[0] is smallest, lst[1] < lst[2]
	
	tmp = getLightest(lst[1], lst[3], lst[4]);
	if (tmp == lst[3])	swap(lst[1], lst[3]);
	else if (tmp == lst[4])	swap(lst[1], lst[4]);
	
	tmp = getMedian(lst[1], lst[3], lst[5]);	
	if (tmp == lst[1]) swap(lst[1], lst[5]), swap(lst[2], lst[5]); // lst[5] < lst[1] < lst[3]; 
	else if (tmp == lst[3])	swap(lst[2], lst[3]), swap(lst[3], lst[5]);	// lst[1] < lst[3] < lst[5]
	else if (tmp == lst[5])	swap(lst[2], lst[5]);	// lst[1] < lst[5] < lst[3]; 
	
	//after swap: lst[1] is smallest, lst[2] < lst[3]
	
	tmp = getLightest(lst[2], lst[4], lst[5]);
	if (tmp == lst[4])	swap(lst[2], lst[4]);
	else if (tmp == lst[5])	swap(lst[2], lst[5]);
	
	// after swap: 0, 1, 2 correct, (3,4,5?)
	
	tmp = getLightest(lst[3], lst[4], lst[5]);
	if (tmp == lst[4])	swap(lst[3], lst[4]);
	else if (tmp == lst[5])	swap(lst[3], lst[5]);
	
	tmp = getMedian(lst[3], lst[4], lst[5]);
	if (tmp == lst[5])	swap(lst[4], lst[5]);
	
	for(int i=0;i<6;i++)	res[i] = lst[i];
	answer(res);
}

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