Submission #134547

#TimeUsernameProblemLanguageResultExecution timeMemory
134547BoxworldScales (IOI15_scales)C++14
0 / 100
3 ms508 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-C-D; int F1=getMedian(A,C,D); int H,I,J,K; if (F1==A){ W[5]=D;K=W[4]=A;J=W[3]=C; }else if (F1==C){ W[5]=A;K=W[4]=C;J=W[3]=D; }else if (F1==D){ W[5]=A;K=W[4]=D;J=W[3]=C; } int G=getMedian(B,E,F);//6 if (G==E){ W[0]=B;H=W[1]=E;I=W[2]=F; }else if (G==B){ W[0]=E;H=W[1]=B;I=W[2]=F; }else if (G==F){ W[0]=E;H=W[1]=F;I=W[2]=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){ 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:54: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:54: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:35:38: warning: 'K' may be used uninitialized in this function [-Wmaybe-uninitialized]
         int M=getNextLightest(H,I,J,K);
                                      ^
scales.cpp:49: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...