# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
136879 | AyaBenSaad | Scales (IOI15_scales) | C++14 | 3 ms | 380 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) {
}
int ans[6];
int a[5], b[5];
void orderCoins() {
a[1] = getLightest (1, 2, 3);
b[1] = getLightest (4, 5, 6);
a[2] = getMedian (1, 2, 3);
b[2] = getMedian (4, 5, 6);
a[3] = 1+2+3-a[1]-a[2];
b[3] = 4+5+6-b[1]-b[2];
ans[0] = getLightest(a[1], b[1], b[2]);
int l = 1, r = 1;
if (ans[0] == a[1]) l++;
else if (ans[0] == b[1]) r++;
ans[1] = getLightest(a[l], b[r], b[3]);
if (ans[1] == a[l]) l++;
else if (ans[1] == b[r]) r++;
ans[2] = getLightest(a[l], b[r], (r == 3 ? a[3] : b[3]));
if (ans[2] == a[l]) l++;
else if (ans[2] == b[r]) r++;
if (l > 3) ans[3] = getLightest(b[1], b[2], b[3]);
else if (r > 3) ans[3] = getLightest (a[1], a[2], a[3]);
else if (l <= 3 && r <= 3) ans[3] = getLightest(a[l], b[r], (r == 3 ? a[3] : b[3]));
if (ans[3] == a[l]) l++;
else if (ans[3] == b[r]) r++;
if(l > 3) ans[4] = getMedian(ans[0], b[2], b[3]);
else if(r > 3) ans[4] = getMedian(ans[0], a[2], a[3]);
else ans[4] = getMedian(ans[0], a[3], b[3]);
ans[5] = (6*7)/2 - (ans[0]+ans[1]+ans[2]+ans[3]+ans[4]);
answer(ans);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |