Submission #163613

# Submission time Handle Problem Language Result Execution time Memory
163613 2019-11-14T10:38:44 Z shenxy Scales (IOI15_scales) C++11
0 / 100
3 ms 504 KB
#include "scales.h"
#include <algorithm>
#include <deque>
using namespace std;
void init(int T) {

}
void orderCoins() {
	int W[6] = {1, 2, 3, 4, 5, 6};
	int x = getLightest(1, 2, 3);
	W[0] = x;
	x = getHeaviest(1, 2, 3);
	W[2] = x;
	for (int i = 1; i <= 3; ++i) {
		if (W[0] != i && W[2] != i) W[1] = i;
	}
	x = getLightest(4, 5, 6);
	W[3] = x;
	x = getHeaviest(4, 5, 6);
	W[5] = x;
	for (int i = 4; i <= 6; ++i) {
		if (W[3] != i && W[5] != i) W[4] = i;
	}
	deque<int> ans;
	if (getHeaviest(W[0], W[2], W[5]) == W[2]) {
		swap(W[0], W[3]);
		swap(W[1], W[4]);
		swap(W[2], W[5]);
	}
	ans.push_front(W[5]);
	int ptr = 4;
	for (int i = 2; i >= 0; --i) {
		x = getNextLightest(W[3], W[4], W[5], W[i]);
		if (x == W[5]) {
			while (ptr > 4) ans.push_front(W[ptr--]);
		} else if (x == W[4]) {
			while (ptr > 3) ans.push_front(W[ptr--]);
		} else {
			while (ptr > 2) ans.push_front(W[ptr--]);
			for (; i >= 0; --i) ans.push_front(W[i]);
			for (int j = 0; j < 6; ++j) W[j] = ans[j];
			answer(W);
			return;
		}
		ans.push_front(W[i]);
	}
	answer(W);
}

Compilation message

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 Incorrect 2 ms 504 KB Output isn't correct
2 Incorrect 2 ms 376 KB Output isn't correct
3 Incorrect 2 ms 376 KB Output isn't correct
4 Incorrect 2 ms 376 KB Output isn't correct
5 Incorrect 2 ms 376 KB Output isn't correct
6 Incorrect 3 ms 376 KB Output isn't correct
7 Incorrect 2 ms 256 KB Output isn't correct
8 Incorrect 2 ms 256 KB Output isn't correct
9 Incorrect 2 ms 376 KB Output isn't correct
10 Incorrect 2 ms 376 KB Output isn't correct
11 Incorrect 2 ms 256 KB Output isn't correct
12 Incorrect 2 ms 376 KB Output isn't correct
13 Incorrect 2 ms 256 KB Output isn't correct
14 Incorrect 2 ms 256 KB Output isn't correct
15 Incorrect 2 ms 376 KB Output isn't correct
16 Incorrect 2 ms 256 KB Output isn't correct
17 Incorrect 2 ms 376 KB Output isn't correct
18 Incorrect 2 ms 376 KB Output isn't correct
19 Incorrect 2 ms 376 KB Output isn't correct
20 Incorrect 2 ms 256 KB Output isn't correct
21 Incorrect 2 ms 376 KB Output isn't correct
22 Incorrect 2 ms 256 KB Output isn't correct
23 Incorrect 2 ms 256 KB Output isn't correct
24 Incorrect 2 ms 376 KB Output isn't correct
25 Incorrect 2 ms 376 KB Output isn't correct
26 Incorrect 2 ms 376 KB Output isn't correct
27 Incorrect 2 ms 256 KB Output isn't correct
28 Incorrect 2 ms 376 KB Output isn't correct
29 Incorrect 3 ms 384 KB Output isn't correct
30 Incorrect 2 ms 256 KB Output isn't correct
31 Incorrect 2 ms 256 KB Output isn't correct
32 Incorrect 2 ms 256 KB Output isn't correct
33 Incorrect 2 ms 256 KB Output isn't correct
34 Incorrect 2 ms 256 KB Output isn't correct
35 Incorrect 2 ms 252 KB Output isn't correct
36 Incorrect 2 ms 256 KB Output isn't correct
37 Incorrect 2 ms 256 KB Output isn't correct
38 Incorrect 2 ms 256 KB Output isn't correct
39 Incorrect 2 ms 256 KB Output isn't correct
40 Incorrect 2 ms 376 KB Output isn't correct