Submission #147087

#TimeUsernameProblemLanguageResultExecution timeMemory
147087nandonathanielScales (IOI15_scales)C++14
45.45 / 100
2 ms400 KiB
#include "scales.h" #include <bits/stdc++.h> using namespace std; int L1,M1,R1,L2,M2,R2,kiri[3],kanan[3],W[5]; void init(int T) { // } void orderCoins() { kiri[0]=getLightest(1,2,3); kiri[2]=getHeaviest(1,2,3); kiri[1]=6-kiri[0]-kiri[2]; kanan[0]=getLightest(4,5,6); kanan[2]=getHeaviest(4,5,6); kanan[1]=15-kanan[0]-kanan[2]; int kecilA=0,kecilB=0,besarA=2,besarB=2; W[0]=getLightest(kiri[kecilA],kanan[kecilB],kiri[besarA]); if(W[0]==kiri[kecilA])kecilA++; else if(W[0]==kanan[kecilB])kecilB++; W[1]=getLightest(kiri[kecilA],kanan[kecilB],kiri[besarA]); if(W[1]==kiri[kecilA])kecilA++; else if(W[1]==kanan[kecilB])kecilB++; if(kecilA==besarA){ W[2]=getLightest(kiri[kecilA],kanan[kecilB],kanan[besarB]); if(W[2]==kiri[kecilA]){ W[3]=kanan[0];W[4]=kanan[1];W[5]=kanan[2]; answer(W); return; } else if(W[2]==kanan[kecilB])kecilB++; W[3]=getLightest(kiri[kecilA],kanan[kecilB],kanan[besarB]); if(W[3]==kiri[kecilA]){ W[4]=kanan[kecilB];W[5]=kanan[besarB]; answer(W); return; } else if(W[3]==kanan[kecilB])kecilB++; W[5]=getHeaviest(kiri[besarA],kanan[besarB],kiri[0]); W[4]=21-W[0]-W[1]-W[2]-W[3]-W[5]; answer(W); return; } W[2]=getLightest(kiri[kecilA],kanan[kecilB],kiri[besarA]); if(W[2]==kiri[kecilA])kecilA++; else if(W[2]==kanan[kecilB])kecilB++; if(kecilB==3){ W[3]=kiri[0];W[4]=kiri[1];W[5]=kiri[2]; answer(W); return; } if(kecilA==besarA){ W[3]=getLightest(kiri[kecilA],kanan[kecilB],kanan[besarB]); if(W[3]==kiri[kecilA]){ W[4]=kanan[kecilB];W[5]=kanan[besarB]; answer(W); return; } else if(W[3]==kanan[kecilB])kecilB++; W[5]=getHeaviest(kiri[besarA],kanan[besarB],kiri[0]); W[4]=21-W[0]-W[1]-W[2]-W[3]-W[5]; answer(W); return; } W[3]=getLightest(kiri[kecilA],kanan[kecilB],kiri[besarA]); if(W[3]==kiri[kecilA])kecilA++; else if(W[3]==kanan[kecilB])kecilB++; if(kecilB==3){ W[4]=kiri[1];W[5]=kiri[2]; answer(W); return; } W[5]=getHeaviest(kiri[besarA],kanan[besarB],kiri[0]); W[4]=21-W[0]-W[1]-W[2]-W[3]-W[5]; answer(W); }

Compilation message (stderr)

scales.cpp: In function 'void init(int)':
scales.cpp:7:15: warning: unused parameter 'T' [-Wunused-parameter]
 void init(int T) {
               ^
scales.cpp: In function 'void orderCoins()':
scales.cpp:28:35: warning: array subscript is above array bounds [-Warray-bounds]
    W[3]=kanan[0];W[4]=kanan[1];W[5]=kanan[2];
                                ~~~^
scales.cpp:35:26: warning: array subscript is above array bounds [-Warray-bounds]
    W[4]=kanan[kecilB];W[5]=kanan[besarB];
                       ~~~^
scales.cpp:40:6: warning: array subscript is above array bounds [-Warray-bounds]
   W[5]=getHeaviest(kiri[besarA],kanan[besarB],kiri[0]);
   ~~~^
scales.cpp:49:32: warning: array subscript is above array bounds [-Warray-bounds]
   W[3]=kiri[0];W[4]=kiri[1];W[5]=kiri[2];
                             ~~~^
scales.cpp:56:26: warning: array subscript is above array bounds [-Warray-bounds]
    W[4]=kanan[kecilB];W[5]=kanan[besarB];
                       ~~~^
scales.cpp:61:6: warning: array subscript is above array bounds [-Warray-bounds]
   W[5]=getHeaviest(kiri[besarA],kanan[besarB],kiri[0]);
   ~~~^
scales.cpp:70:19: warning: array subscript is above array bounds [-Warray-bounds]
   W[4]=kiri[1];W[5]=kiri[2];
                ~~~^
scales.cpp:74:5: warning: array subscript is above array bounds [-Warray-bounds]
  W[5]=getHeaviest(kiri[besarA],kanan[besarB],kiri[0]);
  ~~~^
#Verdict Execution timeMemoryGrader output
Fetching results...