Submission #138845

#TimeUsernameProblemLanguageResultExecution timeMemory
138845dnassScales (IOI15_scales)C++14
0 / 100
3 ms632 KiB
#include "scales.h"
#include <bits/stdc++.h>
using namespace std;

int xxxxxxxxxxx;

void init(int T){
	xxxxxxxxxxx = T;
}

void orderCoins(){
	++xxxxxxxxxxx;
	int f3 = getHeaviest(1,2,3);
	int f1 = getLightest(1,2,3);
	int f2 = -1;
	for(int i=1;i<=3;i++){
		if(i!=f3&&i!=f1) f2 = i;
	}
	int f[] = {f1, f2, f3};
	int s3 = getHeaviest(4,5,6);
	int s1 = getLightest(4,5,6);
	int s2 = -1;
	for(int i=1;i<=3;i++){
		if(i!=s3&&i!=s1) s2 = i;
	}
	int s[] = {s1, s2, s3};
	int W[6];
	int x = 2, y = 2;
	while(x>0||y>0){
		if(x>0){
			if(getHeaviest(f[x], s[y], f[x-1])==f[x]){
				W[x+y+1] = f[x];
				x--;
			}else{
				W[x+y+1] = s[y];
				y--;
			}
		}else{
			if(getHeaviest(f[x], s[y], s[y-1])==f[x]){
				W[x+y+1] = f[x];
				x--;
			}else{
				W[x+y+1] = s[y];
				y--;
			}
		}
	}
	W[1] = f[0];
	W[0] = s[0];
	if(getMedian(f[0], s[0], W[2])==f[0]){
	}else{
		swap(W[1], W[0]);
	}
	answer(W);
	/*
	int x1 = getNextLightest(s1, s2, s3, f1);
	if(x1==s1){
		if(getHeaviest(s1,f1,s3)==f1){
			int W[6] = {s1, s2, s3, f1, f2, f3};
			answer(W);
		}else{

		}
	}else if(x1==s2){
		int x2 = getNextLightest(s2, s3, f3, f2);
		if(x2==f3){
			int x3 = getMedian(f2, s2, s3);
			if(x3==f2){
				int W[6] = {s1, f1, s2, f2, s3, f3};
				answer(W);
			}else if(x3==s2){
				int W[6] = {s1, f1, f2, f3, s2, f3};
				answer(W);
			}else{
				int W[6] = {s1, f1, s2, s3, f2, f3};
				answer(W);
			}
		}else if(x2==s3){
			int W[6] = {s1, f1, s2, f2, s3, f3};
			answer(W);
		}else{
			if(getHeaviest(s1, s3, f3)==s3){
				int W[6] = {s1, f1, f2, s2, f3, s3};
				answer(W);
			}else{
				int W[6] = {s1, f1, f2, s2, s3, f3};
				answer(W);
			}
		}
	}else{
		int x2 = getMedian(f2, f3, s3);
		if(x2==s3){
			int W[6] = {s1, s2, f1, f2, s3, f3};
			answer(W);
		}else if(x2==f2){	
			int W[6] = {s1, s2, f1, s3, f2, f3};
			answer(W);
		}else{
			int W[6] = {s1, s2, f1, f2, f3, s3};
			answer(W);
		}
	}
	*/
}
#Verdict Execution timeMemoryGrader output
Fetching results...