# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
743694 | Abrar_Al_Samit | Scales (IOI15_scales) | C++17 | 1 ms | 300 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 "scales.h"
#include <bits/stdc++.h>
using namespace std;
void init(int T) {
}
void orderCoins() {
int mn[6];
mn[0] = getLightest(1, 2, 3);
mn[5] = getHeaviest(4, 5, 6);
int new_mn;
if(mn[5]==4) new_mn = getLightest(mn[0], 5, 6);
else if(mn[5]==5) new_mn = getLightest(mn[0], 4, 6);
else new_mn = getLightest(mn[0], 4, 5);
if(mn[0]==1) mn[5] = getHeaviest(mn[5], 2, 3);
else if(mn[0]==2) mn[5] = getHeaviest(mn[5], 1, 3);
else mn[5] = getHeaviest(mn[5], 1, 2);
mn[0] = new_mn;
int x[3], at = 0;
for(int i=1; i<=6; ++i) {
if(i==mn[0] || i==mn[5]) continue;
x[at] = i;
++at;
if(at==3) break;
}
mn[1] = getLightest(x[0], x[1], x[2]);
at = 0;
for(int i=6; i>0; --i) {
if(i==mn[0] || i==mn[5] || i==mn[1]) continue;
x[at] = i;
++at;
if(at==2) break;
}
mn[1] = getLightest(mn[1], x[0], x[1]);
at = 0;
for(int i=1; i<=6; ++i) {
if(i==mn[0] || i==mn[5] || i==mn[1]) continue;
x[at] = i;
++at;
}
mn[2] = getLightest(x[0], x[1], x[2]);
mn[3] = getMedian(x[0], x[1], x[2]);
set<int>s = {1, 2, 3, 4, 5, 6};
for(int i=0; i<6; ++i) if(i!=4) {
s.erase(mn[i]);
}
mn[4] = *s.begin();
answer(mn);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |