# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
590177 | FatihSolak | Scales (IOI15_scales) | C++17 | 1 ms | 340 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 W[] = {1, 2, 3, 4, 5, 6};
vector<int> a = {getLightest(1,2,3),0,getHeaviest(1,2,3)};
for(int i = 1;i<=3;i++){
if(a[0] != i && a[2] != i){
a[1] = i;
}
}
vector<int> b = {getLightest(4,5,6),0,getHeaviest(4,5,6)};
for(int i = 4;i<=6;i++){
if(b[0] != i && b[2] != i){
b[1] = i;
}
}
vector<int> ret;
int pt1 = 0,pt2 = 0;
while(pt1 != 3 && pt2 != 3){
if(pt1 == 2){
if(pt2 == 2){
int num = getMedian(a[pt1],a[pt1-1],b[pt2]);
if(num <= 3){
ret.push_back(a[pt1++]);
}
else{
ret.push_back(b[pt2++]);
}
}
else{
int num = getLightest(a[pt1],b[pt2+1],b[pt2]);
if(num <= 3){
ret.push_back(a[pt1++]);
}
else{
ret.push_back(b[pt2++]);
}
}
}
else{
int num = getLightest(a[pt1],a[pt1+1],b[pt2]);
if(num <= 3){
ret.push_back(a[pt1++]);
}
else{
ret.push_back(b[pt2++]);
}
}
}
for(int i = pt1;i<3;i++){
ret.push_back(a[i]);
}
for(int i = pt2;i<3;i++){
ret.push_back(b[i]);
}
assert(ret.size() == 6);
for(int i = 0;i<6;i++){
W[i] = ret[i];
}
answer(W);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |