Submission #430928

#TimeUsernameProblemLanguageResultExecution timeMemory
430928p_squareScales (IOI15_scales)C++14
0 / 100
1 ms204 KiB
#include "scales.h"
#include <bits/stdc++.h>

using namespace std;

/*
int getLightest(int a, int b, int c)
{
	cout<<a<<b<<c;
	int x;
	cin>>x;
	return x;
}

int getHeaviest(int a, int b, int c)
{
	cout<<a<<b<<c<<"HEAVY";
	int x;
	cin>>x;
	return x;
}
*/

void swap(int W[], int x, int y)
{
	W[x] ^= W[y];
	W[y] ^= W[x];
	W[x] ^= W[y];
}

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

void orderCoins() {
    /* ... */
    int W[] = {1, 2, 3, 4, 5, 6};
    int a;
    a = getLightest(1, 2, 3);
    if(a == W[1])
    	swap(W, 0, 1);
    if(a == W[2])
    	swap(W, 0, 2);

    a = getLightest(W[0], W[3], W[4]);
    if(a == W[3])
    	swap(W, 0, 3);
    if(a == W[4])
    	swap(W, 0, 4);

    a = getLightest(W[0], W[2], W[5]);
    if(a == W[5])
    	swap(W, 0, 5);

    a = getLightest(W[1], W[2], W[3]);
    if(a == W[2])
    	swap(W, 1, 2);
    if(a == W[3])
    	swap(W, 1, 3);

    a = getLightest(W[1], W[4], W[5]);
    if(a == W[4])
    	swap(W, 1, 4);
    if(a == W[5])
    	swap(W, 1, 5);

    a = getLightest(W[2], W[3], W[4]);
    if(a == W[3])
    	swap(W, 3, 2);
    if(a == W[4])
    	swap(W, 4, 2);

    a = getMedian(W[2], W[3], W[5]);
    if(a == W[2])
    {
    	swap(W, 5, 2);
        swap(W, 3, 5);
    }
    if(a == W[5])
    {
        swap(W, 5, 3);
    }

    a = getLightest(W[3], W[4], W[5]);
    if(a == W[4])
    	swap(W, 4, 3);
    if(a == W[5])
    	swap(W, 3, 5);

    answer(W);
}

/*
int main()
{
	orderCoins();
}
*/

Compilation message (stderr)

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