Submission #140153

#TimeUsernameProblemLanguageResultExecution timeMemory
140153PedroBigManScales (IOI15_scales)C++14
55.56 / 100
2 ms380 KiB
#include "scales.h" #include <iostream> #include <vector> #include <cmath> #include <algorithm> #include <string> using namespace std; typedef int ll; typedef unsigned long long int ull; typedef long double ld; #define REP(i,a,b) for(ll i=a; i<b; i++) #define pb push_back #define mp make_pair #define pl pair<ll,ll> #define ff first #define ss second #define INF ((ll) pow(2,63) -1) #define gH getHeaviest #define gL getLightest #define gM getMedian #define gNL getNextLightest ll insig; #define In(vecBRO, LENBRO) REP(IBRO,0,LENBRO) {cin>>insig; vecBRO.pb(insig);} void Out(vector<ll> x) {REP(i,0,x.size()) {cout<<x[i]<<" ";} cout<<endl;} ll Q; /*void answer(ll x[]) { REP(i,0,6) {cout<<x[i]<<" ";} cout<<endl; } ll gH(ll x,ll y,ll z) { cout<<"gH "<<x<<" "<<y<<" "<<z<<" "<<endl; ll answ; cin>>answ; return answ; } ll gL(ll x,ll y,ll z) { cout<<"gL "<<x<<" "<<y<<" "<<z<<" "<<endl; ll answ; cin>>answ; return answ; } ll gM(ll x,ll y,ll z) { cout<<"gM "<<x<<" "<<y<<" "<<z<<" "<<endl; ll answ; cin>>answ; return answ; } ll gNL(ll x,ll y,ll z) { cout<<"gNL "<<x<<" "<<y<<" "<<z<<" "<<endl; ll answ; cin>>answ; return answ; }*/ void init(int T) { } void orderCoins() { vector<ll> t1, t2; REP(i,0,3) {t1.pb(0); t2.pb(0);} ll q1,q2; q1 = gH(1,2,3); q2 = gL(1,2,3); t1[0]=q2; t1[2]=q1; REP(i,1,4) { if(q1!=i && q2!=i) {t1[1]=i;} } ll q3, q4; q3 = gH(4,5,6); q4 = gL(4,5,6); t2[0]=q4; t2[2]=q3; REP(i,4,7) { if(q3!=i && q4!=i) {t2[1]=i;} } ll q5 = gH(t1[2],t2[1],t2[2]); ll q6, q7,q8; ll ans[6]; if(q5 == t1[2]) { vector<ll> r1=t1; vector<ll> r2=t2; REP(i,0,3) {t1[i]=r2[i]; t2[i]=r1[i];} ans[5]=t2[2]; q6 = gM(t1[2],t2[0],t2[1]); if(q6==t1[2]) { ans[4]=t2[1]; ans[3]=t1[2]; q7=gM(t1[0],t1[1],t2[0]); if(q7==t1[0]) { ans[0]=t2[0]; ans[1]=t1[0]; ans[2]=t1[1]; } else if(q7==t1[1]) { ans[0]=t1[0]; ans[1]=t1[1]; ans[2]=t2[0]; } else if(q7==t2[0]) { ans[0]=t1[0]; ans[1]=t2[0]; ans[2]=t1[1]; } q8=gM(1,2,3); answer(ans); } else if(q6==t2[0]) { ans[4]=t2[1]; ans[3]=t2[0]; ans[2]=t1[2]; ans[1]=t1[1]; ans[0]=t1[0]; q7 = gM(1,2,3); q8=gM(1,2,3); answer(ans); } else if(q6==t2[1]) { ans[4]=t1[2]; q7=gM(t1[0],t1[1],t2[0]); q8=gM(t1[0],t1[1],t2[1]); if(q7==t1[0] && q8==t1[0]) { ans[0]=t2[0]; ans[1]=t2[1]; ans[2]=t1[0]; ans[3]=t1[1]; } else if(q7==t1[0] && q8==t1[1]) { ans[0]=t2[0]; ans[1]=t1[0]; ans[2]=t1[1]; ans[3]=t2[1]; } else if(q7==t1[0] && q8==t2[1]) { ans[0]=t2[0]; ans[1]=t1[0]; ans[2]=t2[1]; ans[3]=t1[1]; } else if(q7==t1[1] && q8==t1[1]) { ans[0]=t1[0]; ans[1]=t1[1]; ans[2]=t2[0]; ans[3]=t2[1]; } else if(q7==t2[0] && q8==t1[1]) { ans[0]=t1[0]; ans[1]=t2[0]; ans[2]=t1[1]; ans[3]=t2[1]; } else if(q7==t2[0] && q8==t2[1]) { ans[0]=t1[0]; ans[1]=t2[0]; ans[2]=t2[1]; ans[3]=t1[1]; } answer(ans); } } else if(q5 == t2[2]) { ans[5]=t2[2]; q6 = gM(t1[2],t2[0],t2[1]); if(q6==t1[2]) { ans[4]=t2[1]; ans[3]=t1[2]; q7=gM(t1[0],t1[1],t2[0]); if(q7==t1[0]) { ans[0]=t2[0]; ans[1]=t1[0]; ans[2]=t1[1]; } else if(q7==t1[1]) { ans[0]=t1[0]; ans[1]=t1[1]; ans[2]=t2[0]; } else if(q7==t2[0]) { ans[0]=t1[0]; ans[1]=t2[0]; ans[2]=t1[1]; } q8=gM(1,2,3); answer(ans); } else if(q6==t2[0]) { ans[4]=t2[1]; ans[3]=t2[0]; ans[2]=t1[2]; ans[1]=t1[1]; ans[0]=t1[0]; q7 = gM(1,2,3); q8=gM(1,2,3); answer(ans); } else if(q6==t2[1]) { ans[4]=t1[2]; q7=gM(t1[0],t1[1],t2[0]); q8=gM(t1[0],t1[1],t2[1]); if(q7==t1[0] && q8==t1[0]) { ans[0]=t2[0]; ans[1]=t2[1]; ans[2]=t1[0]; ans[3]=t1[1]; } else if(q7==t1[0] && q8==t1[1]) { ans[0]=t2[0]; ans[1]=t1[0]; ans[2]=t1[1]; ans[3]=t2[1]; } else if(q7==t1[0] && q8==t2[1]) { ans[0]=t2[0]; ans[1]=t1[0]; ans[2]=t2[1]; ans[3]=t1[1]; } else if(q7==t1[1] && q8==t1[1]) { ans[0]=t1[0]; ans[1]=t1[1]; ans[2]=t2[0]; ans[3]=t2[1]; } else if(q7==t2[0] && q8==t1[1]) { ans[0]=t1[0]; ans[1]=t2[0]; ans[2]=t1[1]; ans[3]=t2[1]; } else if(q7==t2[0] && q8==t2[1]) { ans[0]=t1[0]; ans[1]=t2[0]; ans[2]=t2[1]; ans[3]=t1[1]; } answer(ans); } } return ; } /*int main() { vector<ll> coins; In(coins,6); orderCoins(); return 0; }*/

Compilation message (stderr)

scales.cpp: In function 'void Out(std::vector<int>)':
scales.cpp:11:33: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
 #define REP(i,a,b) for(ll i=a; i<b; i++)
scales.cpp:24:29:
 void Out(vector<ll> x) {REP(i,0,x.size()) {cout<<x[i]<<" ";} cout<<endl;}
                             ~~~~~~~~~~~~
scales.cpp:24:25: note: in expansion of macro 'REP'
 void Out(vector<ll> x) {REP(i,0,x.size()) {cout<<x[i]<<" ";} cout<<endl;}
                         ^~~
scales.cpp: In function 'void init(int)':
scales.cpp:57:15: warning: unused parameter 'T' [-Wunused-parameter]
 void init(int T) 
               ^
#Verdict Execution timeMemoryGrader output
Fetching results...