제출 #31262

#제출 시각아이디문제언어결과실행 시간메모리
31262top34051저울 (IOI15_scales)C++14
45.45 / 100
0 ms2024 KiB
#include "scales.h" #include<bits/stdc++.h> using namespace std; vector<int> p,a,b,tp; void init(int T) { } void orderCoins() { int i,x,temp,mn,t1,t2; int W[] = {1, 2, 3, 4, 5, 6}; a.clear(); b.clear(); t1 = getLightest(1,2,3); t2 = getLightest(4,5,6); for(i=1;i<=3;i++) { if(i!=t1 && i!=t2) { mn = getLightest(i,t1,t2); break; } } for(i=1;i<=3;i++) if(i!=mn) a.push_back(i); for(i=4;i<=6;i++) if(i!=mn) b.push_back(i); if(a.size()>b.size()) swap(a,b); temp = getLightest(b[0],b[1],b[2]); for(i=0;i<3;i++) if(b[i]==temp) swap(b[i],b[0]); temp = getMedian(b[0],b[1],b[2]); for(i=0;i<3;i++) if(b[i]==temp) swap(b[i],b[1]); p.clear(); p.push_back(mn); for(i=0;i<b.size();i++) p.push_back(b[i]); // cerr << "p : "; // for(i=0;i<p.size();i++) cerr << p[i] << " "; // cerr << "\n"; // // cerr << "a : "; // for(i=0;i<a.size();i++) cerr << a[i] << " "; // cerr << "\n"; x = a[0]; temp = getNextLightest(p[0],p[1],p[2],x); if(temp==p[0]) { temp = getNextLightest(p[0],p[1],p[3],x); if(temp==p[0]) p.push_back(x); else { tp.clear(); for(i=0;i<p.size();i++) { if(temp==p[i]) tp.push_back(x); tp.push_back(p[i]); } p = tp; } } else { tp.clear(); for(i=0;i<p.size();i++) { if(temp==p[i]) tp.push_back(x); tp.push_back(p[i]); } p = tp; } x = a[1]; temp = getNextLightest(p[0],p[1],p[2],x); if(temp==p[0]) { temp = getNextLightest(p[0],p[3],p[4],x); if(temp==p[0]) p.push_back(x); else { tp.clear(); for(i=0;i<p.size();i++) { if(temp==p[i]) tp.push_back(x); tp.push_back(p[i]); } p = tp; } } else { tp.clear(); for(i=0;i<p.size();i++) { if(temp==p[i]) tp.push_back(x); tp.push_back(p[i]); } p = tp; } for(i=0;i<6;i++) W[i] = p[i]; answer(W); }

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

scales.cpp:7:15: warning: unused parameter 'T' [-Wunused-parameter]
 void init(int T) {
               ^
scales.cpp: In function 'void orderCoins()':
scales.cpp:35:14: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(i=0;i<b.size();i++) p.push_back(b[i]);
              ^
scales.cpp:52:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
             for(i=0;i<p.size();i++) {
                      ^
scales.cpp:61:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for(i=0;i<p.size();i++) {
                  ^
scales.cpp:75:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
             for(i=0;i<p.size();i++) {
                      ^
scales.cpp:84:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for(i=0;i<p.size();i++) {
                  ^
#Verdict Execution timeMemoryGrader output
Fetching results...