# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
73054 | MKopchev | Scales (IOI15_scales) | C++14 | 1123 ms | 525312 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)
{
srand(time(0));
}
vector< vector<int> > possible,help;
vector<int> all;
void orderCoins()
{
for(int i=0;i<6;i++)
all.push_back(i+1);
do
{
possible.push_back(all);
}
while(next_permutation(all.begin(),all.end()));
while(possible.size()>1)
{
int a=rand()%6,b=rand()%6,c=rand()%6;
if(a==b||b==c||c==a)continue;
if(rand()%2)
{
int ans=getHeaviest(a+1,b+1,c+1);
ans--;
help={};
for(auto k:possible)
{
if(ans==a&&k[a]>k[b]&&k[a]>k[c])help.push_back(k);
if(ans==b&&k[b]>k[c]&&k[b]>k[a])help.push_back(k);
if(ans==c&&k[c]>k[a]&&k[c]>k[b])help.push_back(k);
}
possible=help;
}
else
{
int ans=getLightest(a+1,b+1,c+1);
ans--;
help={};
for(auto k:possible)
{
if(ans==a&&k[a]<k[b]&&k[a]<k[c])help.push_back(k);
if(ans==b&&k[b]<k[c]&&k[b]<k[a])help.push_back(k);
if(ans==c&&k[c]<k[a]&&k[c]<k[b])help.push_back(k);
}
possible=help;
}
}
int W[6]={possible[0][0],possible[0][1],possible[0][2],possible[0][3],possible[0][4],possible[0][5]};
answer(W);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |