# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
364975 | rocks03 | Scales (IOI15_scales) | C++14 | 1 ms | 512 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"
//#pragma GCC target("avx2")
//#pragma GCC optimization("O3")
//#pragma GCC optimization("unroll-loops")
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pii pair<int, int>
#define pll pair<ll, ll>
#define ff first
#define ss second
#define pb push_back
#define SZ(x) ((int)(x).size())
#define all(x) x.begin(), x.end()
#define rep(i, a, b) for(int i = (a); i < (b); i++)
#define Re(i, a, b) for(int i = (a); i >= (b); i--)
int solution[6];
void init(int T){
}
void answer(int []);
void ordina3(int& x, int& y, int& z){
int c = getHeaviest(x, y, z);
int a = getLightest(x, y, z);
int b;
int arr[] = {x, y, z};
for(int i = 0; i < 3; i++){
if(a != arr[i] && c != arr[i]) b = arr[i];
}
x = a, y = b, z = c;
}
void orderCoins(){
for(int i = 0; i < 6; i++){
solution[i] = i + 1;
}
ordina3(solution[0], solution[1], solution[2]);
ordina3(solution[3], solution[4], solution[5]);
vector<int> my_ans;
int l = 0, r = 3;
while(1){
if(2 - l + 1 + 5 - r + 1 == 3){
for(int i = 0; i < 6; i++){
if(l <= i && i <= 2){
my_ans.pb(solution[i]);
}
if(r <= i && i <= 5){
my_ans.pb(solution[i]);
}
}
ordina3(my_ans[3], my_ans[4], my_ans[5]);
break;
}
if(l + 1 <= 2){
int x1 = solution[l], x2 = solution[l + 1], x3 = solution[r];
int x = getLightest(x1, x2, x3);
if(x1 == x){
my_ans.pb(solution[l++]);
} else if(x3 == x){
my_ans.pb(solution[r++]);
}
} else if(r + 1 <= 5){
int x1 = solution[l], x2 = solution[r], x3 = solution[r + 1];
int x = getLightest(x1, x2, x3);
if(x1 == x){
my_ans.pb(solution[l++]);
} else if(x2 == x){
my_ans.pb(solution[r++]);
}
} else assert(false);
}
for(int i = 0; i < 6; i++){
solution[i] = my_ans[i];
}
answer(solution);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |