#include "scales.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef tuple <ll,ll,ll> plll;
typedef vector <plll> vplll;
typedef pair <ll,ll> pll;
typedef vector <ll> vll;
typedef vector <pll> vpll;
typedef vector <vector <pll>> vvpll;
typedef vector <vector <ll>> vvll;
typedef vector <bool> vb;
typedef vector <vector <bool>> vvb;
#define loop(i, s, e) for (ll i = (s); i < (e); ++i)
#define loopr(i, e, s) for (ll i = (e)-1; i >= (s); --i)
#define all(a) a.begin(), a.end()
const ll inf = 1e9 + 7;
void init(int T) {
/* initialize per-test state if needed */
}
void orderCoins() {
int ans[6];
vll ansi;
set<ll> s;
loop(i,1,7) s.insert(i);
while (!s.empty()) {
if (s.size() ==3) {
auto it = s.begin();
auto it1 = it;
auto it2 = it;
it1++;
it2++;
it2++;
ll b = getHeaviest(*it,*it1,*it2);
ll l = getLightest(*it,*it1,*it2);
ll m;
if ((b==*it && l == *it1 )||(l==*it && b == *it1)) m= *it2;
if ((b==*it && l == *it2 )||(l==*it && b == *it2)) m= *it1;
if ((b==*it1 && l == *it2 )||(l==*it1 && b == *it2)) m= *it;
ansi.push_back(l);
ansi.push_back(m);
ansi.push_back(b);
break;
}
vll v;
ll sz = s.size();
if (sz==6) {
for (auto it : s) v.push_back(it);
ll l = getLightest(v[0], v[1], v[2]);
ll l1 = getLightest(v[sz-1-2], v[sz-1-1] , v[sz-1]);
ll l2 =getLightest(l1, l,v[0] );
ansi.push_back(l2);
s.erase(s.find(l2));
}
else {
for (auto it : s) v.push_back(it);
ll l = getLightest(v[0], v[1], v[2]);
ll x = (l != v[0] ? v[0] : v[1]);
ll l2 = getLightest(l, x , v[sz-1]);
ansi.push_back(l2);
s.erase(s.find(l2));
}
}
loop(i,0,6) ans[i] = ansi[i];
answer(ans);
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |