Submission #579074

#TimeUsernameProblemLanguageResultExecution timeMemory
579074CSQ31Scales (IOI15_scales)C++17
55.56 / 100
1 ms304 KiB
#include "scales.h"
#include <bits/stdc++.h>
using namespace std;
void init(int T) {
    /* ... */
}
void orderCoins(){
	int W[6] = {0,0,0,0,0,0};
	int x = getLightest(1,2,3);
	int y = getLightest(4,5,6);
	W[0] = getLightest(x,y,(y==6?5:6));
	vector<int>c;
	for(int i=1;i<=6;i++){
		if(i!=x && i!=y)c.push_back(i);
	}
	y = getHeaviest(c[0],c[1],c[2]);
	W[5] = getHeaviest(x,y,c[3]);
	
	vector<int>v;
	for(int i=1;i<=6;i++){
		if(i!=W[0] && i!=W[5])v.push_back(i);
	}
	
	x = getMedian(v[0],v[1],v[2]);
	if(v[2] == x)swap(v[1],v[2]);
	if(v[0] == x)swap(v[1],v[0]);
	y = getNextLightest(v[0],v[2],v[3],v[1]);
	if(y == v[3]){
		//a b c d
		//(b,d) = 2,3
		W[2] = v[1];
		W[3] = v[3];
		W[1] = getLightest(v[0],v[2],W[5]);
		if(W[1] == v[2])swap(v[0],v[2]);
		W[4] = v[2];
	}else{
		if(y==v[0])swap(v[0],v[2]);
		//a b c d
		//a d b c
		//d a b c
		x = getNextLightest(v[0],v[1],W[5],v[3]);
		if(x==W[5]){
			W[1] = v[0];
			W[2] = v[1];
			W[3] = v[2];
			W[4] = v[3];
			
		}else if(x==v[1]){
			W[1] = v[0];
			W[2] = v[3];
			W[3] = v[1];
			W[4] = v[2];
			
		}else{
		    W[1] = v[3];
			W[2] = v[0];
			W[3] = v[1];
			W[4] = v[2];
		}
	}
	answer(W);
}

Compilation message (stderr)

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