제출 #414517

#제출 시각아이디문제언어결과실행 시간메모리
414517Bill_00저울 (IOI15_scales)C++14
0 / 100
1 ms300 KiB
#include "scales.h" #include <bits/stdc++.h> using namespace std; void init(int T) { /* ... */ } int a[7],w[7]; void orderCoins() { /* ... */ a[3]=getHeaviest(1,2,3); a[1]=getLightest(1,2,3); for(int i=1;i<=3;i++){ if(i!=a[1] && i!=a[3]){ a[2]=i; } } a[4]=getLightest(4,5,6); a[6]=getHeaviest(4,5,6); for(int i=4;i<=6;i++){ if(i!=a[4] && i!=a[6]){ a[5]=i; } } int x=getNextLightest(1,2,3,a[4]); if(x==a[2]){ w[0]=a[1]; w[1]=a[4]; int z=getMedian(a[2],a[3],a[5]); if(z==a[2]){ w[2]=a[5]; int z=getMedian(a[2],a[3],a[6]); if(z==a[2]){ w[3]=a[6]; w[4]=a[2]; w[5]=a[3]; } if(z==a[3]){ w[3]=a[2]; w[4]=a[3]; w[5]=a[6]; } if(z==a[6]){ w[3]=a[2]; w[4]=a[6]; w[5]=a[3]; } answer(w); } if(z==a[3]){ w[2]=a[2]; w[3]=a[3]; w[4]=a[5]; w[5]=a[6]; answer(w); } if(z==a[5]){ w[2]=a[2]; w[3]=a[5]; z=getHeaviest(a[5],a[6],a[3]); if(z==a[6]){ w[4]=a[3]; w[5]=a[6]; } else{ w[4]=a[6]; w[5]=a[3]; } answer(w); } } if(x==a[3]){ w[0]=a[1]; w[1]=a[2]; w[2]=a[4]; int z=getNextLightest(4,5,6,a[3]); // int t=getLightest(a[4],a[5],a[3]); if(z==a[4]){ w[3]=a[5]; w[4]=a[6]; w[5]=a[3]; } if(z==a[5]){ w[3]=a[3]; w[4]=a[5]; w[5]=a[6]; } if(z==a[6]){ w[3]=a[5]; w[4]=a[3]; w[5]=a[6]; } answer(w); } if(x==a[1]){ int z=getLightest(a[1],a[2],a[4]); if(z==a[1]){ w[0]=a[1]; w[1]=a[2]; w[2]=a[3]; w[3]=a[4]; w[4]=a[5]; w[5]=a[6]; answer(w); } else{ w[0]=a[4]; int t=getMedian(a[1],a[5],a[6]); if(t==a[5]){ w[1]=a[1]; int p=getMedian(a[2],a[5],a[6]); if(p==a[5]){ w[2]=a[2]; int r=getMedian(a[3],a[5],a[6]); if(r==a[5]){ w[3]=a[3]; w[4]=a[5]; w[5]=a[6]; } if(r==a[3]){ w[3]=a[5]; w[4]=a[3]; w[5]=a[6]; } if(r==a[6]){ w[3]=a[5]; w[3]=a[6]; w[3]=a[3]; } answer(w); } if(p==a[2]){ w[2]=a[5]; w[3]=a[2]; int r=getHeaviest(a[2],a[3],a[6]); if(r==a[6]){ w[4]=a[3]; w[5]=a[6]; } else{ w[4]=a[6]; w[5]=a[3]; } answer(w); } if(p==a[6]){ w[2]=a[5]; w[3]=a[6]; w[4]=a[2]; w[5]=a[3]; answer(w); } } if(t==a[1]){ w[1]=a[5]; w[2]=a[1]; int p=getMedian(a[2],a[3],a[6]); if(p==a[2]){ w[3]=a[6]; w[4]=a[2]; w[5]=a[3]; } if(p==a[3]){ w[3]=a[2]; w[4]=a[3]; w[5]=a[6]; } if(p==a[6]){ w[3]=a[2]; w[4]=a[6]; w[5]=a[3]; } answer(w); } if(t==a[6]){ w[1]=a[5]; w[2]=a[6]; w[3]=a[1]; w[4]=a[2]; w[5]=a[3]; answer(w); } } } }

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

scales.cpp: In function 'void init(int)':
scales.cpp:5:15: warning: unused parameter 'T' [-Wunused-parameter]
    5 | void init(int T) {
      |           ~~~~^
scales.cpp: In function 'void orderCoins()':
scales.cpp:32:11: warning: declaration of 'z' shadows a previous local [-Wshadow]
   32 |       int z=getMedian(a[2],a[3],a[6]);
      |           ^
scales.cpp:29:10: note: shadowed declaration is here
   29 |      int z=getMedian(a[2],a[3],a[5]);
      |          ^
#Verdict Execution timeMemoryGrader output
Fetching results...