Submission #128074

#TimeUsernameProblemLanguageResultExecution timeMemory
128074SortingScales (IOI15_scales)C++14
45.45 / 100
2 ms376 KiB
#include <bits/stdc++.h>
#include "scales.h"

using namespace std;

void answer(int *W);
int getHeaviest(int A, int B, int C);
int getLightest(int A, int B, int C);
int getMedian(int A, int B, int C);
int getNextLightest(int A, int B, int C, int D);

void init(int t){

}

vector<int> other(vector<int> v){
	vector<int> ans;

	for(int i = 1; i <= 6; i++){
		bool ok = true;

		for(int x: v){
			if(x == i){
				ok = false;
			}
		}

		if(ok){
			ans.push_back(i);
		}
	}

	return ans;
}

int ans[6];

void orderCoins(){
	int c1 = getLightest(1, 2, 3);
	int c2 = getLightest(4, 5, 6);
	int c3 = getLightest(c1, c2, other(vector<int>{c1, c2})[0]);

	ans[0] = c3;

	int c4, c5;

	if(c3 == c1){
		vector<int> v = other(vector<int>{c1, c2});

		c4 = getLightest(v[0], v[1], v[2]);
		c5 = c2;
	}
	else{
		vector<int> v = other(vector<int>{c1, c2});

		c4 = getLightest(v[1], v[2], v[3]);
		c5 = c1;
	}

	int c6 = getLightest(c4, c5, other(vector<int>{c4, c5, c3})[0]);

	ans[1] = c6;

	int c7 = c4 + c5 - c6;

	vector<int> v1 = other(vector<int>{c4, c5, c3});

	int c8 = getLightest(v1[0], v1[1], v1[2]);

	int c9 = getLightest(c8, c7, other(vector<int>{c4, c5, c3, c8})[0]);

	ans[2] = c9;

	vector<int> v2 = other(vector<int>{c3, c6, c9});

	int c10 = getLightest(v2[0], v2[1], v2[2]);
	int c11 = getHeaviest(v2[0], v2[1], v2[2]);

	ans[3] = c10;
	ans[5] = c11;
	ans[4] = v2[0] + v2[1] + v2[2] - c10 - c11;

	answer(ans);
}

Compilation message (stderr)

scales.cpp: In function 'void init(int)':
scales.cpp:12:15: warning: unused parameter 't' [-Wunused-parameter]
 void init(int t){
               ^
#Verdict Execution timeMemoryGrader output
Fetching results...