Submission #169609

#TimeUsernameProblemLanguageResultExecution timeMemory
169609LawlietScales (IOI15_scales)C++14
55.56 / 100
15 ms504 KiB
#include "scales.h" #include <bits/stdc++.h> using namespace std; void init(int T) { } void orderCoins() { int W[] = {1, 2, 3, 4, 5, 6}; W[0] = getLightest( 1 , 2 , 3 ); W[1] = getMedian( 1 , 2 , 3 ); W[2] = 1 + 2 + 3 - W[0] - W[1]; W[3] = getLightest( 4 , 5 , 6 ); W[4] = getMedian( 4 , 5 , 6 ); W[5] = 4 + 5 + 6 - W[3] - W[4]; if( getHeaviest( W[0] , W[2] , W[5] ) == W[2] ) { swap( W[0] , W[3] ); swap( W[1] , W[4] ); swap( W[2] , W[5] ); } int mn[] = { W[0] , W[1] , W[2] }; int mx[] = { W[3] , W[4] , W[5] }; for(int i = 0 ; i < 3 ; i++) { int ind = getNextLightest( mx[0] , mx[1] , mx[2] , mn[i] ); int p = 0; while( W[p + 1] != ind ) swap( W[p] , W[p + 1] ), p++; } answer( W ); }

Compilation message (stderr)

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