Submission #206405

#TimeUsernameProblemLanguageResultExecution timeMemory
206405batmend저울 (IOI15_scales)C++14
0 / 100
6 ms376 KiB
#include "scales.h"
#include<bits/stdc++.h>
using namespace std;

int ma;
int med;
int val0, val1, val2, val3;


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

void orderCoins() {
    /* ... */
    int pos[7] = {0, 0, 1, 2, 3, 4, 5};
    int W[6] = {1, 2, 3, 4, 5, 6};
	
    ma = getHeaviest(1, 2, 3);
    swap(W[ma - 1], W[2]);
    swap(pos[ma], pos[3]);
    ma = getHeaviest(4, 5, 6);
    swap(W[ma - 1], W[5]);
    swap(pos[ma], pos[6]);
    

   ma = getHeaviest(W[1], W[2], W[5]);
   
    bool w2wasmax = 0;
    if (ma == W[2]) {
    	swap(pos[W[2]], pos[W[5]]);
    	swap(W[2], W[5]);
    	w2wasmax = 1;
    }
    if (w2wasmax == 1) {
    	ma = getHeaviest(W[0], W[1], W[2]);
    }
    if (w2wasmax == 0) {
    	ma = getHeaviest(W[3], W[4], W[2]);
    }

    int val = W[4];
    swap(W[pos[ma]], W[4]);
    swap(pos[val], pos[ma]);

    ma = getHeaviest(W[1], W[2], W[3]);
    val = W[3];
    swap(W[pos[ma]], W[3]);
    swap(pos[ma], pos[val]);
    med = getMedian(W[0], W[1], W[3]);
    val0 = W[0];
    val1 = W[1];
    val3 = W[3];
    if (med == val0) {
		swap(pos[W[0]], pos[W[1]]);
		swap(W[0], W[1]);
    }
    if (med == val3) {
			swap(pos[W[3]], pos[W[0]]);
			swap(W[0], W[3]);
			swap(pos[W[3]], pos[W[1]]);
			swap(W[1], W[3]);
    }
    med = getMedian(W[0], W[1], W[2]);
    val0 = W[0];
    val1 = W[1]; 
    val2 = W[2];
	if (med == val0) {
			swap(pos[W[0]], pos[W[2]]);
			swap(W[0], W[2]);
			swap(pos[W[1]], pos[W[0]]);
			swap(W[1], W[0]);
    }
    if (med == val2) {
			swap(pos[W[1]], pos[W[2]]);
			swap(W[1], W[2]);
    }
    
	answer(W);
}

Compilation message (stderr)

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