Submission #287303

#TimeUsernameProblemLanguageResultExecution timeMemory
287303SaboonScales (IOI15_scales)C++17
0 / 100
1 ms384 KiB
#include "scales.h"
#include <bits/stdc++.h>
using namespace std;

int P[6];

void init(int T){
	/* ... */
}

void solve(vector<int> A){
	int v = A[0], u = A[1], w = A[2], z = A[3];
	int x = getMedian(v,u,w);
	if (u == x) swap(u,v);
	if (w == x) swap(w,v);
	int y = getNextLightest(u,w,z,v);
	if (y == z){
		int p = getLightest(v,u,w);
		P[2] = p, P[3] = v, P[4] = z, P[5] = (w^u^p);
		return;
	}
	if (y == w) swap(w,u);
	int t = getMedian(z,w,v);
	if (t == w)
		P[2] = z, P[3] = w, P[4] = v, P[5] = u;
	else if (t == z)
		P[2] = w, P[3] = z, P[4] = v, P[5] = u;
	else
		P[2] = w, P[3] = v, P[4] = u, P[5] = z;
}

void orderCoins() {
	for (int i = 0; i < 6; i++)
		P[i] = i;
	int v = getLightest(1, 2, 3);
	int u = getLightest(4, 5, 6);
	int w = (v == 1 ? 2 : 1);
	int x = getMedian(v,u,w);
	if (x == v or x == u)
		P[0] = x^v^u, P[1] = x;
	else
		P[0] = v, P[1] = u;
	vector<int> A;
	for (int i = 1; i <= 6; i++)
		if (i != v and i != u)
			A.push_back(i);
	solve(A);
	answer(P);
}

Compilation message (stderr)

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