Submission #1242447

#TimeUsernameProblemLanguageResultExecution timeMemory
1242447tkm_algorithmsScales (IOI15_scales)C++20
45.45 / 100
0 ms328 KiB
/**
*    In the name of Allah
*    We are nothing and you're everything
*    Ya Muhammad!
**/
#include <bits/stdc++.h>
#include "scales.h"

using namespace std;
using ll = long long;
using ull = uint64_t;
 
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
//#define int long long

void init(int T) {
    
}

void orderCoins() {
	int bir;
	bir = getLightest(1, 2, 3);
	bir = getLightest(4, 5, bir);
	bir = getLightest(6, bir, (bir==1?2:1));
	
	int res[6];
	res[0] = bir;
	
	vector<int> g;
	for (int i = 1; i <= 6; ++i)if (bir != i)g.push_back(i);
	
	int iki = getLightest(g[0], g[1], g[2]);
	iki = getLightest(g[3], g[4], iki);
	
	res[1] = iki;
	g.erase(find(all(g), iki));
	
	int uc = getLightest(g[0], g[1], g[2]);
	uc = getMedian(uc, bir, g[3]);
	res[2] = uc;
	g.erase(find(all(g), uc));
	
	int dort = getLightest(g[0], g[1], g[2]);
	res[3] = dort;
	g.erase(find(all(g), dort));
	
	int bas = getMedian(bir, g[0], g[1]);
	res[4] = bas;
	g.erase(find(all(g), bas));
	
	res[5] = g[0];
	answer(res);
}
#Verdict Execution timeMemoryGrader output
Fetching results...