# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1077396 | Trumling | Scales (IOI15_scales) | C++14 | 1 ms | 436 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 F first
#define S second
#define pb push_back
#define INF 99999999999999
#define all(x) x.begin(),x.end()
typedef long long ll;
ll n=6;
void init(int T) {
/* ... */
return ;
}
void orderCoins() {
/* ... */
int ans[6];
ll arr[2][3];
arr[0][1]=getMedian(1,2,3);
arr[0][0]=getLightest(1,2,3);
arr[0][2]= 6 - (arr[0][0] + arr[0][1]);
arr[1][1]=getMedian(4,5,6);
arr[1][0]=getLightest(4,5,6);
arr[1][2]= 15 - (arr[1][0] + arr[1][1]);
ll mid=getMedian(arr[0][2],arr[1][1],arr[1][2]);
if(mid==arr[1][1])
{
ans[0]=arr[0][0];
ans[1]=arr[0][1];
ans[2]=arr[0][2];
ans[3]=arr[1][0];
ans[4]=arr[1][1];
ans[5]=arr[1][2];
ll place=getNextLightest(ans[0],ans[1],ans[2],ans[3]);
if(place==ans[0])
{
place=getMedian(ans[3],ans[0],ans[1]);
if(place==ans[0])
for(int i=2;i>=0;i--)
swap(ans[i],ans[i+1]);
}
else
for(int i=2;i>=0;i--)
{
swap(ans[i],ans[i+1]);
if(ans[i+1]==place)
break;
}
answer(ans);
return ;
}
ans[0]=arr[0][0];
ans[1]=arr[0][1];
ans[2]=arr[1][0];
ans[3]=arr[1][1];
ans[4]=arr[1][2];
ans[5]=arr[0][2];
if(mid==arr[0][2])
swap(ans[4],ans[5]);
mid=getMedian(ans[1],ans[2],ans[3]);
if(mid==ans[1])
{
swap(ans[1],ans[2]);
mid=getLightest(ans[0],ans[1],ans[2]);
if(mid==ans[1])
swap(ans[0],ans[1]);
}
else if(mid==ans[3])
{
swap(ans[1],ans[2]);
swap(ans[2],ans[3]);
mid=getMedian(ans[0],ans[1],ans[2]);
if(mid==ans[2])
{
swap(ans[0],ans[1]);
swap(ans[1],ans[2]);
}
else if(mid==ans[0])
{
swap(ans[0],ans[1]);
}
}
answer(ans);
return ;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |