제출 #1091859

#제출 시각아이디문제언어결과실행 시간메모리
1091859MMihalev저울 (IOI15_scales)C++14
71.43 / 100
1 ms504 KiB
#include "scales.h" #include<deque> #include<stack> #include<iostream> using namespace std; void init(int T) { /* ... */ } deque<int>q; void fr(int x,int num) { stack<int>s; while(x--){s.push(q.front());q.pop_front();} q.push_front(num); while(s.size()){q.push_front(s.top());s.pop();} } void bk(int x,int num) { stack<int>s; while(x--){s.push(q.back());q.pop_back();} q.push_back(num); while(s.size()){q.push_back(s.top());s.pop();} } void orderCoins() { int W[6]; q.clear(); int a=1; int c=getNextLightest(2,3,4,1); int b=2; if(c==2)b=3; int d=((4^a)^(b^c)); int mid=getMedian(a,b,c); if(mid==a) { //b a c int mid2=getMedian(a,b,d); if(mid2==b) { q.push_back(d);q.push_back(b);q.push_back(a);q.push_back(c); } else if(mid2==d) { q.push_back(b);q.push_back(d);q.push_back(a);q.push_back(c); } else { q.push_back(b);q.push_back(a);q.push_back(c);q.push_back(d); } } else if(mid==c) { //a c b int mid2=getMedian(a,b,d); if(mid2==a) { q.push_back(d);q.push_back(a);q.push_back(c);q.push_back(b); } else if(mid2==d) { q.push_back(a);q.push_back(c);q.push_back(d);q.push_back(b); } else { q.push_back(a);q.push_back(c);q.push_back(b);q.push_back(d); } } else { //c b a int lig=getLightest(a,b,d); if(lig==b) { q.push_back(c);q.push_back(b);q.push_back(d);q.push_back(a); } else {q.push_back(c);q.push_back(d);q.push_back(b);q.push_back(a);} } for(int cur=5;cur<=6;cur++) { mid=getMedian(q[1],q[q.size()-2],cur); if(mid==cur) { if(cur==5)fr(2,cur); else { int mid2=getMedian(q[1],q[2],cur); if(mid2==cur)fr(2,cur); else fr(3,cur); } } else if(mid==q[1]) { int mid2=getMedian(q[0],q[1],cur); if(mid2==cur)fr(1,cur); else fr(0,cur); } else { int mid2=getMedian(q[q.size()-1],q[q.size()-2],cur); if(mid2==cur)bk(1,cur); else bk(0,cur); } } for(int i=0;i<6;i++) { W[i]=q[i]; } answer(W); }

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

scales.cpp: In function 'void init(int)':
scales.cpp:6:15: warning: unused parameter 'T' [-Wunused-parameter]
    6 | void init(int T)
      |           ~~~~^
#Verdict Execution timeMemoryGrader output
Fetching results...