제출 #791890

#제출 시각아이디문제언어결과실행 시간메모리
791890jasmin저울 (IOI15_scales)C++17
55.56 / 100
1 ms212 KiB
#include "scales.h" #include<bits/stdc++.h> using namespace std; void init(int T) { /* ... */ } void orderCoins() { //find smallest int small1=getLightest(1, 2, 3); set<int> group1={1, 2, 3}; group1.erase(small1); int small2=getLightest(4, 5, 6); set<int> group2={4, 5, 6}; group2.erase(small2); int middle=getMedian(small1, small2, *group1.begin()); vector<int> order; if(middle==small1){ order={small2, small1, *group1.begin()}; group1.erase(*group1.begin()); swap(group1, group2); swap(small1, small2); } else if(middle==small2){ order={small1, small2, *group1.begin()}; group1.erase(*group1.begin()); } else{ order={small1, *group1.begin(), small2}; group1.erase(*group1.begin()); } //finish group 1 //we only know that they are larger than the first one middle=getMedian(order[1], order[2], *group1.begin()); if(middle==order[1]){ order.push_back(order[2]); order[2]=order[1]; order[1]=*group1.begin(); } else if(middle==order[2]){ order.push_back(*group1.begin()); } else{ order.push_back(order[2]); order[2]=*group1.begin(); } group1.erase(*group1.begin()); if(!group1.empty()){ int elem=*group1.begin(); if(getLightest(order[1], order[2], elem)==elem){ order.push_back(order[3]); order[3]=order[2]; order[2]=order[1]; order[1]=elem; } else{ middle=getMedian(order[2], order[3], elem); if(middle==order[2]){ order.push_back(order[3]); order[3]=order[2]; order[2]=elem; } else if(middle==order[3]){ order.push_back(elem); } else{ order.push_back(order[3]); order[3]=elem; } } group1.erase(elem); } //finish group 2 if(group2.size()==2){ //wir sind grösser als element 1 int elem=*group2.begin(); middle=getMedian(order[2], order[3], elem); if(middle==order[2]){ order.push_back(order[3]); order[3]=order[2]; order[2]=elem; } else if(middle==order[3]){ order.push_back(elem); } else{ order.push_back(order[3]); order[3]=elem; } group2.erase(elem); } int indsmall2=2; for(int i=0; i<(int)order.size(); i++){ if(order[i]==small2){ indsmall2=i; } } int elem=*group2.begin(); if(indsmall2<2 && getLightest(order[2], order[3], elem)==elem){ order.push_back(order[4]); order[4]=order[3]; order[3]=order[2]; order[2]=elem; } else{ middle=getMedian(order[3], order[4], elem); if(middle==order[3]){ order.push_back(order[4]); order[4]=order[3]; order[3]=elem; } else if(middle==order[4]){ order.push_back(elem); } else{ order.push_back(order[4]); order[4]=elem; } } int W[] = {1, 2, 3, 4, 5, 6}; for(int i=0; i<6; i++){ W[i]=order[i]; } 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) {
      |           ~~~~^
#Verdict Execution timeMemoryGrader output
Fetching results...