# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
802039 | Khizri | Scales (IOI15_scales) | C++17 | 1 ms | 304 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "scales.h"
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
void init(int T) {
/* ... */
}
void orderCoins() {
int mx=getHeaviest(1,2,3);
int mx2=getHeaviest(4,5,6);
set<int>st{{1,2,3,4,5,6}};
st.erase(mx);
st.erase(mx2);
int x=*st.begin();
int largest=getHeaviest(mx,mx2,x);
int mn=getLightest(1,2,3);
int mn2=getLightest(4,5,6);
int m=6-mx-mn;
int m2=15-mx2-mn2;
deque<int>l={mn,m,mx};
deque<int>r={mn2,m2,mx2};
vector<int>ans;
while(l.size()&&r.size()){
int a=l[0],b=r[0];
if(a==largest){
while(r.size()){
ans.pb(r[0]);
r.pop_front();
}
ans.pb(a);
l.pop_front();
}
else if(b==largest){
while(l.size()){
ans.pb(l[0]);
l.pop_front();
}
ans.pb(b);
r.pop_front();
}
else{
int x=getLightest(a,b,largest);
ans.pb(x);
if(x==a){
l.pop_front();
}
else{
r.pop_front();
}
}
}
while(l.size()){
ans.pb(l[0]);
l.pop_front();
}
while(r.size()){
ans.pb(r[0]);
r.pop_front();
}
int W[]={0,0,0,0,0,0};
for(int i=0;i<ans.size();i++){
W[i]=ans[i];
}
answer(W);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |