# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
977278 | IUA_Hasin | Scales (IOI15_scales) | C++17 | 1 ms | 348 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>
#define endl "\n"
#define ll long long
int t;
int vis[7];
void init(int T) {
t = T;
}
void orderCoins() {
for(int i=0; i<7; i++){
vis[i] = 0;
}
int w[6];
int a = getHeaviest(1, 2, 3);
int b = getHeaviest(4, 5, 6);
int c;
if(a==1){
c = getHeaviest(a, b, 2);
} else {
c = getHeaviest(a, b, 1);
}
w[5] = c;
vis[c] = 1;
int a1;
if(c==a){
if(a==1){
a1 = getHeaviest(b, 2, 3);
} else if(a==2){
a1 = getHeaviest(b, 1, 3);
} else {
a1 = getHeaviest(b, 1, 2);
}
} else {
if(b==4){
a1 = getHeaviest(a, 5, 6);
} else if(b==5){
a1 = getHeaviest(a, 4, 6);
} else {
a1 = getHeaviest(a, 4, 5);
}
}
w[4] = a1;
vis[a1] = 1;
std::vector<ll> v;
for(int i=1; i<=6; i++){
if(vis[i]==0){
v.push_back(i);
}
}
int a2 = getHeaviest(v[0], v[1], v[2]);
int a3;
if(a2==v[0]){
a3 = getHeaviest(a2, v[1], v[3]);
} else {
a3 = getHeaviest(a2, v[0], v[3]);
}
w[3] = a3;
vis[a3] = 1;
std::vector<ll> v2;
for(int i=1; i<=6; i++){
if(vis[i]==0){
v2.push_back(i);
}
}
int a4 = getHeaviest(v2[0], v2[1], v2[2]);
int a5 = getLightest(v2[0], v2[1], v2[2]);
int a6 = getMedian(v2[0], v2[1], v2[2]);
w[2] = a4;
w[1] = a6;
w[0] = a5;
answer(w);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |