# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
136805 | Nucleist | Scales (IOI15_scales) | C++14 | 4 ms | 632 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 flash ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define debug(x) cerr << " - " << #x << ": " << x << endl;
#define debugs(x, y) cerr << " - " << #x << ": " << x << " " << #y << ": " << y << endl;
#define all(x) (x).begin(),(x).end()
#define sz(x) (ll)x.size()
#define ll long long
#define INF 1000000000
#define pb push_back
void init(int T)
{
for (int i = 0; i < T; ++i)
{
orderCoins();
}
}
void orderCoins()
{
int tab[6];
bool tabi[6];
int v = getLightest(0,1,2);
int yo = getLightest(v,3,4);
tabi[v]=true;tabi[yo]=true;
int last=0;
for (int i = 0; i < 6; ++i)
{
if(!tabi[v]){last=i;break;}
}
int no = getLightest(last,yo,5);
tab[no]=1;
memset(tabi,0,sizeof tabi);
tabi[no]=1;
vector<int>now;
for (int i = 0; i < 6; ++i)
{
if(tabi[i]==0)now.pb(i);
}
int dol = getNextLightest(no,now[0],now[1],now[2]);
int fol = getNextLightest(no,now[2],now[3],now[4]);
for (int i = 0; i < 5; ++i)
{
if(now[i]!=fol && now[i]!=dol){last=now[i];break;}
}
int ka;
if(fol==dol){ka=fol;debug(fol);}
else {
ka = getLightest(last,fol,dol);
}
tab[ka]=2;
now.clear();
for (int i = 0; i < 6; ++i)
{
if(i!=ka && i!=no)now.pb(i);
}
int hi = getNextLightest(ka,now[0],now[1],now[2]);
int fi = getNextLightest(ka,now[1],now[2],now[3]);
for (int i = 0; i < 4; ++i)
{
if(now[i]!=hi && now[i]!=fi){last=now[i];break;}
}
int doli;
if(hi==fi)doli=hi;
else
{
doli = getLightest(last,hi,fi);
}
tab[doli]=3;
now.clear();
for (int i = 0; i < 6; ++i)
{
if(i!=no && i!=doli && i!=ka)now.pb(i);
}
int nexti = getNextLightest(doli,now[0],now[1],now[2]);
tab[nexti]=4;
now.clear();
for (int i = 0; i < 6; ++i)
{
if(i!=no && i!=doli && i!=ka && i!=nexti)now.pb(i);
}
int nexta = getHeaviest(nexti,now[0],now[1]);
if(nexta==now[0])
{
tab[now[1]]=5;tab[now[0]]=6;
}
else {
tab[now[0]]=5;tab[now[1]]=6;}
answer(tab);
return ;
}
//code the AC sol !
// BS/queue/map
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |