# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
470190 | Cross_Ratio | Scales (IOI15_scales) | C++14 | 1 ms | 204 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;
void init(int T) {return;}
void orderCoins() {
int a = getLightest(1, 2, 3);
int b = getMedian(1, 2, 3);
int c = 6 - a - b;
//assert(getHeaviest(1,2,3)==c);
int d = getLightest(4, 5 ,6);
int e = getMedian(4, 5, 6);
int f = 15 - d - e;
//assert(getHeaviest(4,5,6)==f);
// a b c / d e f
int k1 = getNextLightest(a, b, c, e);
if(k1 == b) {
// a e b c
//assert(getMedian(a,e,b)==e);
int k2 = getNextLightest(e, b, c, f);
int k3 = getMedian(a, d, e);
if(k2==e) {
if(k3==a) {
int ans[6] = {d,a,e,b,c,f};
answer(ans);
return;
}
if(k3==d) {
int ans[6] = {a,d,e,b,c,f};
answer(ans);
return;
}
}
if(k2==b) {
if(k3==a) {
int ans[6] = {d,a,e,f,b,c};
answer(ans);
return;
}
if(k3==d) {
int ans[6] = {a,d,e,f,b,c};
answer(ans);
return;
}
}
if(k2==c) {
if(k3==a) {
int ans[6] = {d,a,e,b,f,c};
answer(ans);
return;
}
if(k3==d) {
int ans[6] = {a,d,e,b,f,c};
answer(ans);
return;
}
}
}
if(k1 == c) {
//a b e c
//assert(getMedian(b,e,c)==e);
int k2 = getNextLightest(a, b, e, d);
int k3 = getMedian(e, c, f);
if(k2==a) {
if(k3==c) {
int ans[6] = {d,a,b,e,c,f};
answer(ans);
return;
}
if(k3==f) {
int ans[6] = {d,a,b,e,f,c};
answer(ans);
return;
}
}
if(k2==b) {
if(k3==c) {
int ans[6] = {a,d,b,e,c,f};
answer(ans);
return;
}
if(k3==f) {
int ans[6] = {a,d,b,e,f,c};
answer(ans);
return;
}
}
if(k2==e) {
if(k3==c) {
int ans[6] = {a,b,d,e,c,f};
answer(ans);
return;
}
if(k3==f) {
int ans[6] = {a,b,d,e,f,c};
answer(ans);
return;
}
}
}
// e a b c or a b c e
int k2 = getMedian(d, e, a);
if(k2 == d) {
//a (b c d) e f
int k3 = getNextLightest(a,b,c,d);
if(k3==a) {
int ans[6] = {a,b,c,d,e,f};
answer(ans);
return;
}
if(k3==b) {
int ans[6] = {a,d,b,c,e,f};
answer(ans);
return;
}
if(k3==c) {
int ans[6] = {a,b,d,c,e,f};
answer(ans);
return;
}
}
if(k2 == e) {
// d e a b c
int k3 = getNextLightest(a,b,c,f);
if(k3==b) {
int ans[6] = {d,e,a,f,b,c};
answer(ans);
return;
}
if(k3==c) {
int ans[6] = {d,e,a,b,f,c};
answer(ans);
return;
}
if(k3==a) {
int k4 = getMedian(e,a,f);
assert(k4 != e);
if(k4==a) {
int ans[6] = {d,e,a,b,c,f};
answer(ans);
return;
}
if(k4==f) {
int ans[6] = {d,e,f,a,b,c};
answer(ans);
return;
}
}
}
if(k2 == a) {
//d a e -> d a b c e f
int ans[6] = {d,a,b,c,e,f};
answer(ans);
return;
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |