Submission #128019

# Submission time Handle Problem Language Result Execution time Memory
128019 2019-07-10T10:32:06 Z MoNsTeR_CuBe Scales (IOI15_scales) C++17
0 / 100
3 ms 504 KB
#include "scales.h"
#include <bits/stdc++.h>

using namespace std;



void init(int T) {
}

void orderCoins() {
    int W[] = {1, 2, 3, 4, 5, 6};
    
    vector< int > left;
    vector< int > right;
    
    left.push_back(getLightest(W[0], W[1], W[2]));
    left.push_back(getMedian(W[0], W[1], W[2]));
    for(int i = 0; i < 3; i++){
		bool verif = false;
		for(int j = 0; j < 2; j++){
			if(left[j] == W[i]) verif = true;
		}
		if(!verif) left.push_back(W[i]);
	}
	
	right.push_back(getLightest(W[3], W[4], W[5]));
	right.push_back(getMedian(W[3], W[4], W[5]));
	
	for(int i = 3; i < 6; i++){
		bool verif = false;
		for(int j = 0; j < 2; j++){
			if(right[j] == W[i]) verif = true;
		}
		if(!verif) right.push_back(W[i]);
	}
    
    int rem = 6;
    
    vector< int > ans;
    
    while(rem > 3){
		if((int)left.size() >= 2){
			ans.push_back(getHeaviest(left.back(), left[left.size()-2], right.back()));
			if(ans.back() == right.back()) right.pop_back();
			if(ans.back() == left.back()) left.pop_back();
		}else{
			ans.push_back(getHeaviest(left.back(), right[right.size()-2], right.back()));
			if(ans.back() == right.back()) right.pop_back();
			if(ans.back() == left.back()) left.pop_back();
		}
		rem--;
	}
    
    vector< int > remaining;
    
    while(!left.empty()){
		remaining.push_back(left.back());
		left.pop_back();
	}
    while(!right.empty()){
		remaining.push_back(right.back());
		right.pop_back();
	}
	ans.push_back(getHeaviest(remaining[0], remaining[1], remaining[2]));
	ans.push_back(getMedian(remaining[0], remaining[1], remaining[2]));
	ans.push_back(getLightest(remaining[0], remaining[1], remaining[2]));
    for(int i = 0; i < 6; i++){
		W[i] = ans[i];
	}
    answer(W);
}

Compilation message

scales.cpp: In function 'void init(int)':
scales.cpp:8:15: warning: unused parameter 'T' [-Wunused-parameter]
 void init(int T) {
               ^
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 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 256 KB Output isn't correct
5 Incorrect 2 ms 256 KB Output isn't correct
6 Incorrect 2 ms 376 KB Output isn't correct
7 Incorrect 2 ms 256 KB Output isn't correct
8 Incorrect 2 ms 376 KB Output isn't correct
9 Incorrect 2 ms 256 KB Output isn't correct
10 Incorrect 2 ms 256 KB Output isn't correct
11 Incorrect 2 ms 376 KB Output isn't correct
12 Incorrect 2 ms 376 KB Output isn't correct
13 Incorrect 2 ms 376 KB Output isn't correct
14 Incorrect 2 ms 376 KB Output isn't correct
15 Incorrect 2 ms 376 KB Output isn't correct
16 Incorrect 2 ms 376 KB Output isn't correct
17 Incorrect 2 ms 376 KB Output isn't correct
18 Incorrect 2 ms 256 KB Output isn't correct
19 Incorrect 2 ms 504 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 256 KB Output isn't correct
26 Incorrect 3 ms 364 KB Output isn't correct
27 Incorrect 2 ms 256 KB Output isn't correct
28 Incorrect 2 ms 256 KB Output isn't correct
29 Incorrect 2 ms 256 KB Output isn't correct
30 Incorrect 2 ms 376 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 376 KB Output isn't correct
36 Incorrect 2 ms 376 KB Output isn't correct
37 Incorrect 2 ms 376 KB Output isn't correct
38 Incorrect 2 ms 376 KB Output isn't correct
39 Incorrect 2 ms 376 KB Output isn't correct
40 Incorrect 2 ms 256 KB Output isn't correct