# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1045508 | Alihan_8 | Scales (IOI15_scales) | C++17 | 1 ms | 440 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;
#define pb push_back
void init(int T) {
/* ... */
}
void orderCoins() {
vector <int> us(7);
vector <int> ans;
int x = getLightest(1, 2, 3), y = getLightest(4, 5, 6), z = -1;
for ( int i = 1; i <= 6; i++ ){
if ( i != x && i != y ){
z = i;
}
}
int t = getLightest(x, y, z);
ans.pb(t); us[t] = 1;
auto f = [&](){
vector <int> l, r;
for ( int i = 1; i <= 6; i++ ){
if ( !us[i] && l.size() < 3 ){
l.pb(i);
}
}
for ( int i = 6; i > 0; i-- ){
if ( !us[i] && r.size() < 3 ){
r.pb(i);
}
}
x = getLightest(l[0], l[1], l[2]);
y = getLightest(r[0], r[1], r[2]);
if ( x == y ){
ans.pb(x); us[x] = 1;
} else{
t = getMedian(ans[0], x, y);
ans.pb(t); us[t] = 1;
}
};
f(), f();
vector <int> r;
for ( int i = 1; i <= 6; i++ ){
if ( !us[i] ) r.pb(i);
}
x = getLightest(r[0], r[1], r[2]);
y = getMedian(r[0], r[1], r[2]);
ans.pb(x), ans.pb(y);
for ( auto &t: r ){
if ( t != x && t != y ) ans.pb(t);
}
int w[6];
for ( int i = 0; i < 6; i++ ){
w[i] = ans[i];
}
answer(w);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |