Submission #299730

#TimeUsernameProblemLanguageResultExecution timeMemory
299730mohamedsobhi777Scales (IOI15_scales)C++14
55.56 / 100
1 ms384 KiB
#include "scales.h" #include<bits/stdc++.h> using namespace std ; int Te ; void init(int T) { Te = T ; /* ... */ } void orderCoins() { int W[6] = {0,0,0,0,0,0} ; int it = 0 ; int cnt = 0 ; vector<int> perm[2] ; perm[0] = { getLightest(1 , 2 , 3) , getMedian(1 , 2, 3) } ; perm[0].push_back(6 - perm[0][0] - perm[0][1]) ; perm[1] = { getLightest(4 , 5 , 6) , getMedian(4 , 5, 6) } ; perm[1].push_back(15 - perm[1][0] - perm[1][1]) ; int answer1 = getNextLightest(perm[0][0] , perm[0][1] , perm[1][1] , perm[1][0] ) ; if(answer1 == perm[1][1]){ int ele = getMedian(perm[0][0], perm[0][1], perm[1][0]) ; if(ele == perm[0][0]){ W[0] = perm[1][0] ; W[1] = perm[1][1] ; int mn1 = getLightest(perm[0][0] , perm[0][1] , perm[1][2]) ; if(mn1 == perm[0][0]){ W[2] = perm[0][0] ; int md = getMedian(perm[0][1] , perm[0][2] , perm[1][2]) ; if(md == perm[0][1]){ W[3] = perm[1][2] ; W[4] = perm[0][1] ; W[5] = perm[0][2] ; }else if( md == perm[0][2]){ W[3] = perm[0][1] ; W[4] = perm[0][2] ; W[5] = perm[1][2] ; }else{ W[3] = perm[0][1] ; W[4] = perm[1][2] ; W[5] = perm[0][2] ; } }else{ W[2] = mn1 ; W[3] = perm[0][0] ; W[4] = perm[0][1] ; W[5] = perm[0][2] ; } }else if(perm[0][1] == ele){ W[0] = perm[0][0] ; W[1] = perm[0][1] ; int mn1 = getLightest(perm[0][2] , perm[1][0] , perm[1][1]) ; W[2] = mn1 ; if(mn1 == perm[0][2]){ W[3] = perm[1][0] ; W[4] = perm[1][1] ; W[5] = perm[1][2] ; }else{ int md1 = getMedian(perm[0][2] , perm[1][1], perm[1][2]) ; if(md1 == perm[0][2]){ W[3] = perm[1][1] ; W[4] = md1 ; W[5] = perm[1][2] ; }else if(perm[1][1] == md1){ W[3] = perm[0][2] ; W[4] = md1 ; W[5] = perm[1][2] ; }else{ W[3] = perm[1][1] ; W[4] = md1 ; W[5] = perm[0][2] ; } } }else if(perm[1][0] == ele){ W[0] = perm[0][0] ; W[1] = perm[1][0] ; int gmd = getMedian(perm[0][2] , perm[1][1] , perm[1][2]) ; if(gmd == perm[0][2]){ W[5] = perm[1][2] ; int gmd2 = getMedian(perm[0][1] , perm[0][2] , perm[1][1]) ; if(gmd2 == perm[0][1]){ W[2] = perm[1][1] ; W[3] = perm[0][1] ; W[4] = perm[0][2] ; }else if(gmd2 == perm[0][2]){ W[2] = perm[0][1] ; W[3] = perm[0][2] ; W[4] = perm[1][1] ; }else{ W[2] = perm[0][1] ; W[3] = perm[1][1] ; W[4] = perm[0][2] ; } }else if(gmd == perm[1][2]){ W[5] = perm[0][2] ; int gmd2 = getMedian(perm[0][1] , perm[1][2] , perm[1][1]) ; if(gmd2 == perm[0][1]){ W[2] = perm[1][1] ; W[3] = perm[0][1] ; W[4] = perm[1][2] ; }else if(gmd2 == perm[1][1]){ W[2] = perm[0][1] ; W[3] = perm[1][1] ; W[4] = perm[1][2] ; }else{ W[2] = perm[1][1] ; W[3] = perm[1][2] ; W[4] = perm[0][1] ; } }else{ W[2] = perm[0][1] ; W[3] = perm[0][2] ; W[4] = perm[1][1] ; W[5] = perm[1][2] ; } } } else if(answer1 == perm[0][1]){ W[0] = perm[0][0] ; W[1] = perm[1][0] ; W[2] = perm[0][1] ; int md = getMedian(perm[0][2] , perm[1][1], perm[1][2]) ; W[4] = md ; if(md == perm[0][2]){ W[3] = perm[1][1] ; W[5] = perm[1][2] ; }else if(md == perm[1][1]){ W[3] = perm[0][2] ; W[5] = perm[1][2] ; }else{ W[3] = perm[1][1] ; W[5] = perm[0][2] ; } }else if(answer1 == perm[0][0]){ W[0] = perm[1][0] ; W[1] = perm[0][0] ; int gmd = getMedian(perm[0][2] , perm[1][1] , perm[1][2]) ; if(gmd == perm[0][2]){ W[5] = perm[1][2] ; int gmd2 = getMedian(perm[0][1] , perm[0][2] , perm[1][1]) ; if(gmd2 == perm[0][1]){ W[2] = perm[1][1] ; W[3] = perm[0][1] ; W[4] = perm[0][2] ; }else if(gmd2 == perm[0][2]){ W[2] = perm[0][1] ; W[3] = perm[0][2] ; W[4] = perm[1][1] ; }else{ W[2] = perm[0][1] ; W[3] = perm[1][1] ; W[4] = perm[0][2] ; } }else if(gmd == perm[1][2]){ W[5] = perm[0][2] ; int gmd2 = getMedian(perm[0][1] , perm[1][2] , perm[1][1]) ; if(gmd2 == perm[0][1]){ W[2] = perm[1][1] ; W[3] = perm[0][1] ; W[4] = perm[1][2] ; }else if(gmd2 == perm[1][1]){ W[2] = perm[0][1] ; W[3] = perm[1][1] ; W[4] = perm[1][2] ; }else{ W[2] = perm[1][1] ; W[3] = perm[1][2] ; W[4] = perm[0][1] ; } }else{ W[2] = perm[0][1] ; W[3] = perm[0][2] ; W[4] = perm[1][1] ; W[5] = perm[1][2] ; } } answer(W); }

Compilation message (stderr)

scales.cpp: In function 'void orderCoins()':
scales.cpp:17:13: warning: unused variable 'it' [-Wunused-variable]
   17 |         int it = 0 ;
      |             ^~
scales.cpp:18:13: warning: unused variable 'cnt' [-Wunused-variable]
   18 |         int cnt = 0 ;
      |             ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...