Submission #1246604

#TimeUsernameProblemLanguageResultExecution timeMemory
1246604santi3223Scales (IOI15_scales)C++20
45.45 / 100
1 ms328 KiB
#include <bits/stdc++.h>
#include "scales.h"
using namespace std;
#define ll long long
#define vb vector<bool>
#define pb push_back
#define ff(aa, bb, cc) for(int aa = bb; aa < cc; aa++)
#define vl vector<ll>
#define pll pair<ll, ll>
#define fi first
#define se second
#define ed "\n"
#define all(aaa) aaa.begin(), aaa.end()
#define rall(aaa) aaa.rbegin(), aaa.rend()
ll MOD = 1e9+7;
/*
vector<int> respuesta, cur;

int getHeaviest(int A, int B, int C){
	A--;
	B--;
	C--;
	if(cur[A] > cur[B] && cur[A] > cur[C]){
		return A+1;
	}
	if(cur[C] > cur[B] && cur[C] > cur[A]){
		return C+1;
	}
	return B+1;
}

int getLightest(int A, int B, int C){
	A--;
	B--;
	C--;
	if(cur[A] < cur[B] && cur[A] < cur[C]){
		return A+1;
	}
	if(cur[C] < cur[B] && cur[C] < cur[A]){
		return C+1;
	}
	return B+1;
}

int getMedian(int A, int B, int C){
	A--;
	B--;
	C--;
	if((cur[A] < cur[B] && cur[B] < cur[C]) || (cur[C] < cur[B] && cur[B] < cur[A])){
		return B+1;
	}
	if((cur[B] < cur[A] && cur[A] < cur[C]) || (cur[C] < cur[A] && cur[A] < cur[B])){
		return A+1;
	}
	return C+1;
}

void answer(vector<int> r){
	ff(i, 0, 6){
		cout << r[i] << " ";
	}
	cout << ed;
	respuesta = r;
}
*/
void init(int T) {
    //nada
}

void orderCoins() {
    ll h1 = getHeaviest(1, 2, 3);
    ll h2 = getHeaviest(h1, 4, 5);
    ll a = 1;
    if(h2 == 1){
		a = 2;
	}
    ll h3 = getHeaviest(h2, a, 6);
    
    vector<int> ans;
	vb used(10, false);
	ans.pb(h3);
	used[h3] = true;
	//Hallamos 1, la mas pesada
	//cout << h3 << ed;
	//answer({0, 0, 0, 0, 0, (int)h3});
	
	vl coins;
	//cout << "1-COINS ";
	ff(i, 1, 7){
		if(!used[i]){
			//cout << i << " ";
			coins.pb(i);
		}
	}
	//cout << ed;
	h1 = getHeaviest(coins[0], coins[1], coins[2]);
	h2 = getHeaviest(h1, coins[3], coins[4]);
	ans.pb(h2);
	//Ya tenemos la 2da mas pesada;
	//cout << ans[1] << ed;
	used[h2] = true;
	//answer({0, 0, 0, 0, ans[1], ans[0]});
	
	coins.clear();
	//cout << "2-COINS ";
	ff(i, 1, 7){
		if(!used[i]){
			//cout << i << " ";
			coins.pb(i);
		}
	}
	//cout << ed;
	h1 = getHeaviest(coins[0], coins[1], coins[2]);
	if(h1 == coins[0]){
		//cout << "C1" << ed;
		h2 = getHeaviest(coins[3], h1, coins[2]);
	}
	else if(h1 == coins[1]){
		//cout << "C2" << ed;
		h2 = getHeaviest(coins[3], h1, coins[2]);
	}
	else if(h1 == coins[2]){
		//cout << "C3" << ed;
		h2 = getHeaviest(coins[3], h1, coins[1]);
	}
	ans.pb(h2);
	used[h2] = true;
	//Ya tenemos la 3ra mas pesada;
	//cout << ans[2] << ed;
	//answer({0, 0, 0, ans[2], ans[1], ans[0]});
	
	coins.clear();
	//cout << "3-COINS ";
	ff(i, 1, 7){
		if(!used[i]){
			//cout << i << " ";
			coins.pb(i);
		}
	}
	//cout << ed << ed;
	h1 = getHeaviest(coins[0], coins[1], coins[2]);
	ans.pb(h1);
	used[h1] = true;
	//Ya tenemos la 4ta;
	//cout << ans[3] << ed;
	//answer({0, 0, ans[3], ans[2], ans[1], ans[0]});
	
	h1 = getMedian(coins[0], coins[1], coins[2]);
	ans.pb(h1);
	used[h1] = true;
	//La 5ta;
	//cout << ans[4] << ed;
	//answer({0, ans[4], ans[3], ans[2], ans[1], ans[0]});
	ff(i, 1, 7){
		if(!used[i]){
			ans.pb(i);
			break;
		}
	}
	//6ta
	//cout << ans[5] << ed;
	reverse(all(ans));
	int resp[6];
	ff(i, 0, 6){
		resp[i] = ans[i];
	}
	answer(resp);
	return;
	
}
/*
int main() {
	ll T;
	cin >> T;
	init(T);
	while(T--){
		ll N = 6;
		cur = vector<int>(N);
		vector<int> input;
		ff(i, 0, N){
			int x;
			cin >> x;
			input.pb(x);
			x--;
			cur[x] = i+1;
		}
		orderCoins();
		if(input != respuesta){
			cout << "Original ";
			ff(i, 0, N){
				cout << input[i] << " ";
			}
			cout << ed;
			cout << "Respuesta ";
			ff(i, 0, N){
				cout << respuesta[i] << " ";
			}
			cout << ed << ed;
		}
	}    
    return 0;
}
*/
#Verdict Execution timeMemoryGrader output
Fetching results...