# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
432218 | jeqcho | Scales (IOI15_scales) | C++17 | 1 ms | 292 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;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
#define FOR(i,a,b) for(int i=a;i<b;++i)
#define F0R(i,b) FOR(i,0,b)
#define ROF(i,a,b) for(int i=b-1;i>=a;--i)
#define R0F(i,b) ROF(i,0,b)
#define trav(a,x) for(auto&a:x)
#define all(x) begin(x),end(x)
#define fi first
#define se second
#define pb push_back
#define sz(x) int(x.size())
void init(int T) {
/* ... */
}
vi decode(int mask)
{
vi cur(3);
int idx=0;
F0R(i,6)
{
if(mask&(1<<i))
{
cur[idx]=i+1;
++idx;
}
}
return cur;
}
void orderCoins() {
vi cnt(6);
F0R(i,1<<6)
{
int pc=__builtin_popcount(i);
if(pc!=3)continue;
vi v = decode(i);
int mx = getHeaviest(v[0],v[1],v[2]);
--mx;
++cnt[mx];
}
vpi rank;
F0R(i,6)
{
rank.pb({cnt[i],i+1});
}
sort(all(rank));
int mn = getLightest(rank[0].se,rank[1].se,rank[2].se);
if(mn==rank[1].se)swap(rank[0],rank[1]);
int W[6];
F0R(i,6)
{
W[i]=rank[i].se;
}
answer(W);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |