# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
619840 | amin | Scales (IOI15_scales) | C++14 | 1 ms | 224 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) {
/* ... */
}/*
long getLightest(long x,long xx,long xxx)
{
x--;
xx--;
xxx--;
if(a[x]<a[xx]&&a[x]<a[xxx])
{
return x+1;
}else
if(a[xx]<a[x]&&a[xx]<a[xxx])
{
return xx+1;
}else
return xxx+1;
}
long getHeaviest(long x,long xx,long xxx)
{
x--;
xx--;
xxx--;
if(a[x]>a[xx]&&a[x]>a[xxx])
{
return x+1;
}else
if(a[xx]>a[x]&&a[xx]>a[xxx])
{
return xx+1;
}else
return xxx+1;
}
long getMedian(long x,long xx,long xxx)
{
x--;
xx--;
xxx--;
if(a[x]>a[xx]&&a[x]<a[xxx])
{
return x+1;
}else
if(a[xx]>a[x]&&a[xx]<a[xxx])
{
return xx+1;
}
if(a[x]<a[xx]&&a[x]>a[xxx])
{
return x+1;
}
if(a[xx]<a[x]&&a[xx]>a[xxx])
{
return xx+1;
}
return xxx+1;
}
*/
void orderCoins() {
/* ... */
int W[] = {1, 2, 3, 4, 5, 6};
long o=getLightest(1,2,3);
long oo=getLightest(4,5,6);
swap(W[0],W[o-1]);
swap(W[3],W[oo-1]);
vector<long>ans;
o=getLightest(W[0],W[1],W[3]);
cout<<o<<endl;
vector<long>v;
ans.push_back(o);
if(W[3]==o)
{
swap(W[0],W[3]);
swap(W[1],W[4]);
swap(W[2],W[5]);
}
long k=getLightest(W[1],W[2],W[3]);
cout<<k<<endl;
ans.push_back(k);
for(long i=0;i<6;i++)
{
if(W[i]!=k&&W[i]!=o)
{
v.push_back(W[i]);
}
}
long z=getMedian(v[2],v[3],ans[0]);
long x=getLightest(v[0],v[1],z);
for(long i=0;i<4;i++)
{
if(v[i]==x)
{
v.erase(v.begin()+i);
}
}
ans.push_back(x);
o=getLightest(v[0],v[1],v[2]);
oo=getHeaviest(v[0],v[1],v[2]);
ans.push_back(o);
for(long i=0;i<3;i++)
{
if(v[i]!=o&&v[i]!=oo)
{
ans.push_back(v[i]);
break;
}
}
ans.push_back(oo);
for(long i=0;i<6;i++)
{
W[i]=ans[i];
}
answer(W);
}/*
int main()
{
for(long i=0;i<6;i++)
{
cin>>a[i];
}
vector<long>f;
f=orderCoins();
for(long i=0;i<6;i++)
{
cout<<f[i]<<' ';
}
cout<<endl;
}*/
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |