Submission #256600

#TimeUsernameProblemLanguageResultExecution timeMemory
256600oscarsierra12Scales (IOI15_scales)C++14
71.43 / 100
1 ms384 KiB
#include "scales.h" #include <bits/stdc++.h> using namespace std ; void init(int T) { /* ... */ } void orderCoins() { /* ... */ vector<int> coins, W ; int x; for ( int i = 1 ; i < 7 ; ++i ) coins.push_back(i) ; for ( int i = 2 ; i < 6 ; i += 2 ) { x = getLightest(coins[1], coins[i], coins[i+1]) ; if (x == coins[i]) swap(coins[1], coins[i]) ; if (x == coins[i+1]) swap(coins[1], coins[i+1]) ; } x = getHeaviest(coins[2], coins[3], coins[4]) ; set<int> cual ; for (int i = 2 ; i < 5 ; ++i) cual.insert(coins[i]) ; for ( int i = 2 ; i < 5 ; ++i ) { if (x != coins[i]) continue ; swap(coins[i], coins[5]) ; break ; } x = getNextLightest(coins[2], coins[3], coins[4], coins[1]) ; for ( int i = 2 ; i < 5 ; ++i ) { if (x != coins[i]) continue ; swap(coins[i], coins[2]) ; break ; } if (cual.count(coins[3]) && cual.count(coins[4])) { x = getLightest(coins[3], coins[4], coins[5]) ; if (x == coins[4]) swap(coins[3], coins[4]); } else { x = getMedian(coins[3], coins[4], coins[5]) ; if (x == coins[5]) { if (cual.count(coins[4])) swap(coins[3], coins[4]) ; swap(coins[4], coins[5]) ; } else if (cual.count(x)) { if(cual.count(coins[3])) swap(coins[3], coins[4]) ; } else if (cual.count(coins[4])) swap(coins[3],coins[4]) ; } x = getMedian(coins[0], coins[2], coins[4]) ; if(x == coins[2]) { x = getLightest(coins[0], coins[1], coins[2]) ; W.push_back(coins[0]) ; W.push_back(coins[1]) ; if (x == coins[1]) swap(W[0], W[1]) ; for ( int i = 2 ; i < 6 ; ++i ) W.push_back(coins[i]) ; } else if (x == coins[4]) { x = getHeaviest(coins[0], coins[5], coins[4]) ; for ( int i = 1 ; i < 5 ; ++i ) W.push_back(coins[i]) ; W.push_back(coins[0]) ; W.push_back(coins[5]) ; if (x == coins[0]) swap(W[4], W[5]) ; } else { x = getNextLightest(coins[2], coins[3], coins[4], coins[0]) ; for ( int i = 1 ; i < 6 ; ++i ) { if (x != coins[i]) { W.push_back(coins[i]) ; continue ; } W.push_back(coins[0]) ; for ( int j = i ; j < 6 ; ++j) W.push_back(coins[j]) ; break ; } } int Wr[] = {W[0], W[1], W[2], W[3], W[4], W[5]}; answer(Wr); } ///6 2 3 5 4 1

Compilation message (stderr)

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