# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
346000 | emaborevkovic | Scales (IOI15_scales) | C++14 | 1 ms | 384 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;
#define ll long long
#define ss second
#define ff first
#define mp make_pair
#define pb push_back
int res[7];
void orderCoins() {
int a1, a2, a3, a4, a5, a6; // a1 < a2 < a3 && a4 < a5 < a6
a1 = getLightest(1, 2, 3);
a2 = getMedian(1, 2, 3);
if (a1 != 1 && a2 != 1) a3 = 1;
if (a1 != 2 && a2 != 2) a3 = 2;
if (a1 != 3 && a2 != 3) a3 = 3;
a4 = getLightest(4, 5, 6);
a5 = getMedian(4, 5, 6);
if (a4 != 4 && a5 != 4) a6 = 4;
if (a4 != 5 && a5 != 5) a6 = 5;
if (a4 != 6 && a5 != 6) a6 = 6; // do sad smo iskoristili 4 upita
int x = getNextLightest(a4, a5, a3, a2);
if (x == a4) {
int srednji = getMedian(a5, a3, a6);
res[0] = a1; res[1] = a2; res[2] = a4;
if (srednji == a5) {
res[3] = a3;
res[5] = a6;
}
else if (srednji == a3) {
res[3] = a5;
res[5] = a6;
}
else {
res[3] = a5;
res[5] = a3;
}
res[4] = srednji;
}
else if (x == a3) {
int manji = getLightest(a1, a4, a2);
if (manji == a1) {
res[0] = a1;
res[1] = a4;
}
else {
res[0] = a4;
res[1] = a1;
}
res[2] = a2;
res[3] = a5;
int veci = getHeaviest(a3, a6, a1);
if (veci == a3) {
res[5] = a3;
res[4] = a6;
}
else {
res[4] = a3;
res[5] = a6;
}
}
else {
int next1 = getNextLightest(a4, a5, a2, a1);
if (next1 == a4) {
res[0] = a1;
res[1] = a4;
res[2] = a5;
int next2 = getNextLightest(a2, a3, a1, a6);
if (next2 == a2) {
res[3] = a6;
res[4] = a2;
res[5] = a3;
}
else if (next2 == a3) {
res[3] = a2;
res[4] = a6;
res[5] = a3;
}
else {
res[3] = a2;
res[4] = a3;
res[5] = a6;
}
}
else if (next1 == a5) {
res[0] = a4;
res[1] = a1;
res[2] = a5;
int next2 = getNextLightest(a2, a3, a1, a6);
if (next2 == a2) {
res[3] = a6;
res[4] = a2;
res[5] = a3;
}
else if (next2 == a3) {
res[3] = a2;
res[4] = a6;
res[5] = a3;
}
else {
res[3] = a2;
res[4] = a3;
res[5] = a6;
}
}
else {
res[0] = a4;
res[1] = a5;
int next2 = getNextLightest(a1, a2, a3, a6);
if (next2 == a2) {
res[2] = a1;
res[3] = a6;
res[4] = a2;
res[5] = a3;
}
else if (next2 == a3) {
res[2] = a1;
res[3] = a2;
res[4] = a6;
res[5] = a3;
}
else {
int najmanji = getLightest(a1, a6, a2);
if (najmanji == a6) {
res[2] = a6;
res[3] = a1;
res[4] = a2;
res[5] = a3;
}
else {
res[2] = a1;
res[3] = a2;
res[4] = a3;
res[5] = a6;
}
}
}
}
answer(res);
return;
}
void init(int t) {}
/*
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
vector <int> v = {1, 2, 5};
cout << delivery(3, 2, 8, v);
return 0;
}
*/
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |