제출 #579278

#제출 시각아이디문제언어결과실행 시간메모리
579278Leo121저울 (IOI15_scales)C++14
0 / 100
1 ms212 KiB
#include "scales.h" void init(int T) { /* ... */ } void orderCoins() { /* ... */ int W[] = {1, 2, 3, 4, 5, 6}; int res = getLightest(1, 2, 3), res3 = getHeaviest(1, 2, 3), res2, res4, res5; res2 = 6 - res - res3; res4 = getNextLightest(1, 2, 3, 4); bool bandera = 1; W[0] = res; if(res4 != res){ if(res4 == res2){ W[1] = 4; W[2] = res2; W[3] = res3; res = 4; } else if(res4 == res3){ W[2] = 4; W[1] = res2; W[3] = res3; res = res2; res2 = 4; } } else{ res5 = res; res = 4; res4 = getHeaviest(res, res2, res3); if(res4 == res3){ res = res5; bandera = 0; } else if(res4 == res){ W[0] = res5; W[1] = res2; W[2] = res3; W[4] = 4; res = res2; res2 = res3; res3 = 4; } } int poracomodar1 = 10 - res - res2 - res3, poracomodar2, poracomodar3; res4 = getNextLightest(res, res2, res3, 5); if(res4 != res){ poracomodar2 = res; if(res4 == res2){ W[1] = res; W[2] = 5; W[3] = res2; W[4] = res3; res = 5; } else if(res4 == res3){ W[1] = res; W[2] = res2; W[3] = 5; W[4] = res3; res = res2; res2 = 5; } } else{ res5 = res; res = 5; res4 = getHeaviest(res, res2, res3); if(res4 == res3){ res = res5; poracomodar2 = 5; bandera = 0; } else if(res4 == res){ W[1] = res5; W[2] = res2; W[3] = res3; W[4] = 5; res = res2; res2 = res3; res3 = 5; poracomodar2 = res5; } } res4 = getNextLightest(res, res2, res3, 6); if(res4 != res){ poracomodar3 = res; if(res4 == res2){ W[2] = res; W[3] = 6; W[4] = res2; W[5] = res3; res = 6; } else if(res4 == res3){ res = res2; res2 = 6; W[2] = res; W[3] = res2; W[4] = 6; W[5] = res3; } } else{ res5 = res; res = 6; res4 = getHeaviest(res, res2, res3); if(res4 == res3){ res = res5; poracomodar3 = 6; bandera = 0; } else if(res4 == res){ res = res2; res2 = res3; res3 = 6; poracomodar3 = res5; W[2] = res5; W[3] = res2; W[4] = res3; W[5] = 6; } } if(!bandera){ W[5] = res3; W[4] = res2; W[3] = res; res = getLightest(poracomodar1, poracomodar2, poracomodar3), res2 = getHeaviest(poracomodar1, poracomodar2, poracomodar3); W[2] = res2; W[0] = res; W[1] = poracomodar1 + poracomodar2 + poracomodar3 - res - res2; } answer(W); }

컴파일 시 표준 에러 (stderr) 메시지

scales.cpp: In function 'void init(int)':
scales.cpp:3:15: warning: unused parameter 'T' [-Wunused-parameter]
    3 | void init(int T) {
      |           ~~~~^
scales.cpp: In function 'void orderCoins()':
scales.cpp:131:88: warning: 'poracomodar3' may be used uninitialized in this function [-Wmaybe-uninitialized]
  131 |         res = getLightest(poracomodar1, poracomodar2, poracomodar3), res2 = getHeaviest(poracomodar1, poracomodar2, poracomodar3);
      |                                                                             ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
scales.cpp:134:29: warning: 'poracomodar2' may be used uninitialized in this function [-Wmaybe-uninitialized]
  134 |         W[1] = poracomodar1 + poracomodar2 + poracomodar3 - res - res2;
      |                ~~~~~~~~~~~~~^~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...