제출 #786533

#제출 시각아이디문제언어결과실행 시간메모리
786533vnm06저울 (IOI15_scales)C++14
55.56 / 100
1 ms248 KiB
#include "scales.h" #include<bits/stdc++.h> using namespace std; void init(int T) { /* ... */ } void orderCoins() { /* ... */ int W[6] = {1, 2, 3, 4, 5, 6}; int sm1=getLightest(1, 2, 3); int sm2=getLightest(4, 5, 6); int t=sm1+1; if(t==sm2) t++; W[0]=getLightest(sm1, sm2, t); if(W[0]==sm1) W[1]=getLightest(sm2, sm1%3+1, (sm1+1)%3+1); else W[1]=getLightest(sm1, sm2%3+4, (sm2+1)%3+4); vector<int> vr; vr.resize(0); for(int i=1; i<=6; i++) if(W[0]!=i && W[1]!=i) vr.push_back(i); if(vr.size()!=4) {answer(W); exit(0);} int t2=getLightest(vr[0], vr[1], vr[2]); if(t2==vr[0]) W[2]=getLightest(vr[0], vr[2], vr[3]); else W[2]=getLightest(vr[0], t2, vr[3]); for(int i=0; i<3 && i<vr.size(); i++) if(vr[i]==W[2]) swap(vr[i], vr[3]); W[3]=getLightest(vr[0], vr[1], vr[2]); W[5]=getHeaviest(vr[0], vr[1], vr[2]); W[4]=21-W[0]-W[1]-W[2]-W[3]-W[5]; 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:26:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   26 |     for(int i=0; i<3 && i<vr.size(); i++) if(vr[i]==W[2]) swap(vr[i], vr[3]);
      |                         ~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...