Submission #134548

#TimeUsernameProblemLanguageResultExecution timeMemory
134548BoxworldScales (IOI15_scales)C++14
55.56 / 100
3 ms380 KiB
#include "scales.h" #include <bits/stdc++.h> using namespace std; void init(int T) { /* ... */ } void orderCoins() { int W[6]; int A=getHeaviest(1,2,3); int B=getLightest(1,2,3); int C=6-A-B; int D=getHeaviest(4,5,6); int E=getLightest(4,5,6); int F=15-D-E; int G1=getMedian(A,C,D); int H,I,J,K; if (G1==A){ W[5]=D; J=C;K=A; }else if (G1==C){ W[5]=A; J=D;K=C; }else if (G1==D){ W[5]=A; J=C;K=D; } int G=getMedian(B,E,F);//6 if (G==E){ W[0]=B; H=E;I=F; }else if (G==B){ W[0]=E; H=B;I=F; }else if (G==F){ W[0]=E; H=F;I=B; } int L=getMedian(H,I,J); if (L==H){ int M=getNextLightest(H,I,J,K); if (M==J){ W[1]=J;W[2]=H;W[3]=I;W[4]=K; answer(W); }else if (M==H){ W[1]=J;W[2]=K;W[3]=H;W[4]=I; answer(W); }else if (M==I){ W[1]=J;W[2]=H;W[3]=K;W[4]=I; answer(W); } }else if (L==I){ W[1]=H;W[2]=I;W[3]=J;W[4]=K; answer(W); }else if (L==J){ int M=getNextLightest(H,I,J,K); if (M==H){ W[1]=H;W[2]=J;W[3]=I;W[4]=K; answer(W); }else if (M==I){ W[1]=H;W[2]=J;W[3]=K;W[4]=I; answer(W); } } }

Compilation message (stderr)

scales.cpp: In function 'void init(int)':
scales.cpp:4:15: warning: unused parameter 'T' [-Wunused-parameter]
 void init(int T) {
               ^
scales.cpp: In function 'void orderCoins()':
scales.cpp:61:38: warning: 'I' may be used uninitialized in this function [-Wmaybe-uninitialized]
             W[1]=H;W[2]=J;W[3]=K;W[4]=I;
                                  ~~~~^~
scales.cpp:61:17: warning: 'H' may be used uninitialized in this function [-Wmaybe-uninitialized]
             W[1]=H;W[2]=J;W[3]=K;W[4]=I;
             ~~~~^~
scales.cpp:41:38: warning: 'K' may be used uninitialized in this function [-Wmaybe-uninitialized]
         int M=getNextLightest(H,I,J,K);
                                      ^
scales.cpp:56:38: warning: 'J' may be used uninitialized in this function [-Wmaybe-uninitialized]
         int M=getNextLightest(H,I,J,K);
                                      ^
#Verdict Execution timeMemoryGrader output
Fetching results...