# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
60801 | Flugan42 | Scales (IOI15_scales) | C++14 | 4 ms | 684 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 rep(i,a,b) for(ll i = a; i < b; i++)
#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 trav(a,x) for(auto a : x)
#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];
rep(i,0,3) 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> befA;
vi _; befA.assign(4,_);
bool check = true;
rep(i,0,3){
rep(j,0,3){
if (a[i] == A[j]){
if (j == 0 && check){
befA[j].push_back(B[i]);
} else if (j == 0) {
befA[3].push_back(B[i]);
} else {
befA[j].push_back(B[i]);
check = false;
}
}
}
}
ll cur = 0;
rep(i,0,4){
trav(j,befA[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... |