# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
58569 | ngkan146 | Scales (IOI15_scales) | C++11 | 5 ms | 680 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) {
/* do nothing */
}
void orderCoins() {
int res[6];
vector <int> lst;
for(int i=1;i<=6;i++) lst.push_back(i);
for(int i=0;i<=5;i++){
if (i == 0 || i == 1 || i == 2 || i == 3){
int good = getLightest(lst[i], lst[i+1], lst[i+2]);
if (good == lst[i+1]) swap(lst[i], lst[i+1]);
else if (good == lst[i+2]) swap(lst[i], lst[i+2]);
}
if (i == 2){
int good = getLightest(lst[i], lst[i+2], lst[i+3]);
if (good == lst[i+2]) swap(lst[i], lst[i+2]);
else if (good == lst[i+3]) swap(lst[i], lst[i+3]);
}
if (i == 0 || i == 1){
int good = getLightest(lst[i], lst[i+3], lst[i+4]);
if (good == lst[i+3]) swap(lst[i], lst[i+3]);
else if (good == lst[i+4]) swap(lst[i], lst[i+4]);
}
if (i == 0){
int good = getLightest(lst[i], lst[i+4], lst[i+5]);
if (good == lst[i+4]) swap(lst[i], lst[i+4]);
else if (good == lst[i+5]) swap(lst[i], lst[i+5]);
}
}
if (getMedian(lst[3], lst[4], lst[5]) == lst[5])
swap(lst[4], lst[5]);
for(int i=0;i<6;i++) res[i] = lst[i];
answer(res);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |