# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
409867 | EJOI2019Andrew | Scales (IOI15_scales) | C++14 | 1 ms | 332 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;
typedef long long ll;
typedef vector<ll> vi;
typedef pair<ll,ll> ii;
typedef vector<ii> vii;
typedef long double lld;
#define per(i,a,b) for(ll i = a; i >= b; i--)
#define all(x) x.begin(),x.end()
#define sz(x) (ll)(x).size()
#define inf 1000000000000000000
void init(int T) {
}
void orderCoins() {
int W[] = {1, 2, 3, 4, 5, 6};
int A[3],B[3];
A[0] = getLightest(1,2,3);
A[1] = getMedian(1,2,3);
A[2] = 6-A[0]-A[1];
B[0] = getLightest(4,5,6);
B[1] = getMedian(4,5,6);
B[2] = 15-B[0]-B[1];
ll a[3];
for(ll i = 0; i < 3; i++)
a[i] = getNextLightest(A[0],A[1],A[2],B[i]);
if (a[0] == A[0] && a[1] == A[0] && a[2] == A[0])
{
if (getLightest(A[0],A[1],B[1]) == B[1])
{
W[0] = B[0];
W[1] = B[1];
if (getLightest(A[0],A[1],B[2]) == B[2]){
W[2] = B[2];
W[3] = A[0];
W[4] = A[1];
W[5] = A[2];
} else {
W[2] = A[0];
W[3] = A[1];
W[4] = A[2];
W[5] = B[2];
}
} else {
W[4] = B[1];
W[5] = B[2];
if (getLightest(A[0],A[1],B[0]) == B[0]){
W[0] = B[0];
W[1] = A[0];
W[2] = A[1];
W[3] = A[2];
} else {
W[0] = A[0];
W[1] = A[1];
W[2] = A[2];
W[3] = B[0];
}
}
} else {
vector<vi> Z;
vi _;
Z.assign(4,_);
bool check = true;
for(int i=0; i<3; ++i)
{
for(int j=0; j<3; ++ j)
if (a[i] == A[j]){
if (j == 0 && check){
Z[j].push_back(B[i]);
} else if (j == 0) {
Z[3].push_back(B[i]);
} else {
Z[j].push_back(B[i]);
check = false;
}
}
}
ll cur = 0;
for(int i=0; i<4; ++i)
{
for(auto j:Z[i])
{
W[cur] = j;
cur++;
}
if (i < 3)
{
W[cur] = A[i];
cur++;
}
}
}
answer(W);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |