# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
668797 | victor_gao | 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 <bits/stdc++.h>
#include "scales.h"
using namespace std;
void init(int T) {
/* ... */
}
void orderCoins() {
/* ... */
int W[] = {1, 2, 3, 4, 5, 6};
int mn,nxt,mid;
vector<int>q;
for (int i=1;i<=3;i++)
q.push_back(i);
deque<int>f;
mn=getLightest(1,2,3);
f.push_front(mn);
q.erase(find(q.begin(),q.end(),mn));
nxt=getNextLightest(q[0],q[1],4,mn);
if (nxt==4){
f.push_back(4);
mid=getMedian(q[0],q[1],4);
if (mid==q[0]){
f.push_back(q[0]);
f.push_back(q[1]);
}
else {
f.push_back(q[1]);
f.push_back(q[0]);
}
}
else {
q.erase(find(q.begin(),q.end(),nxt));
f.push_back(nxt);
f.push_back(6-mn-nxt);
mid=getMedian(mn,6-mn-nxt,4);
if (mid==4)
f.insert(f.begin()+2,4);
else if (mid==mn) f.push_front(4);
else f.push_back(4);
}
nxt=getNextLightest(f[0],f[1],f[3],5);
if (nxt==f[0]){
mid=getMedian(f[0],f[3],5);
if (mid==f[0]) f.insert(f.begin(),5);
else if (mid==f[3]) f.push_back(5);
else f.push_front(5);
}
else if (nxt==f[1])
f.insert(f.begin()+1,5);
else {
mid=getMedian(f[2],f[3],5);
if (mid==f[2])
f.insert(f.begin()+2,5);
else f.insert(f.begin()+3,5);
}
nxt=getNextLightest(f[0],f[2],f[4],6);
if (nxt==f[0]){
mid=getMedian(f[0],f[4],6);
if (mid==f[0]) f.push_front(6);
else f.push_back(6);
}
else if (nxt==f[2]){
mid=getMedian(f[1],f[2],6);
if (mid==f[1]) f.insert(f.begin()+1,6);
else f.insert(f.begin()+2,6);
}
else {
mid=getMedian(f[3],f[4],6);
if (mid==f[3]) f.insert(f.begin()+3,6);
else f.insert(f.begin()+4,6);
}
/*
for (auto i:f)
cout<<i<<" ";
cout<<'\n';
*/
for (int i=0;i<6;i++)
W[i]=f[i];
answer(W);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |