# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
619670 | A_D | Scales (IOI15_scales) | C++14 | 1 ms | 300 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;
void init(int T) {
/* ... */
}
void orderCoins() {
int W[] = {6, 6, 6, 6, 6, 6};
vector<int> vec1;
vector<int> vec2;
set<int> st;
vec1.push_back(getLightest(1,2,3));
vec1.push_back(getMedian(1,2,3));
st.insert(1);st.insert(2);st.insert(3);
st.erase(vec1[0]);st.erase(vec1[1]);
vec1.push_back(*st.begin());
st.clear();
vec2.push_back(getLightest(4,5,6));
vec2.push_back(getMedian(4,5,6));
st.insert(4);st.insert(5);st.insert(6);
st.erase(vec2[0]);st.erase(vec2[1]);
vec2.push_back(*st.begin());
st.clear();
int l=0,r=0;
int cnt=0;
while(cnt<6){
// cout<<l<<" "<<r<<" "<<cnt<<"\n";
if(l==3){
W[cnt]=vec2[r];
r++;
cnt++;
continue;
}
if(r==3){
W[cnt]=vec1[l];
l++;
cnt++;
continue;
}
if(l==2&&r==2){
int u=getMedian(vec1[0],vec1[l],vec2[r]);
W[cnt]=u;
cnt++;
if(u==vec1[l]){
l++;
}
else{
r++;
}
continue;
}
if(l<2){
int u=getLightest(vec1[2],vec1[l],vec2[r]);
W[cnt]=u;
cnt++;
if(u==vec1[l]){
l++;
}
else{
r++;
}
continue;
}
if(r<2){
int u=getLightest(vec2[2],vec1[l],vec2[r]);
W[cnt]=u;
cnt++;
if(u==vec1[l]){
l++;
}
else{
r++;
}
continue;
}
// cout<<"ASSERT(0)\n";
assert(0);
}
// for(int i=0;i<6;i++)cout<<W[i]<<" ";cout<<"\n";
answer(W);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |