# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
783776 | lollipop | Scales (IOI15_scales) | C++17 | 0 ms | 0 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<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/rope>
//#define int long long
#define pb push_back
#define s second
#define f first
#define pf push_front
#define inf 100000000000000000
#define bitebi __builtin_popcountll
#define FOR( i , n ) for( int i = 0 ; i < n ; i ++ )
#define YES cout <<"YES\n"
#define NO cout << "NO\n"
#define debug cout << "Here Fine" << endl ;
#define pr pair < int , int >
#define fbo find_by_order // returns iterator
#define ook order_of_key // returns strictly less numbers than key
using namespace std ;
//#pragma GCC optimize("Ofast")
//#pragma GCC target("avx,avx2,fma")
using namespace __gnu_pbds;
using namespace __gnu_cxx;
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
const double Pi=acos(-1.0);
const double EPS=1E-8;
const int mod = 1000000007 ;
const int mod1 = 998244353 ;
const int N = 2e5 + 10 ;
mt19937 R(time(0));
map < int , int > ma , ma1 ;
#include "scales.h"
void init(int T){
// heheh
}
void orderCoins(){
vector < int > vi ;
FOR( i , 6 ) vi.pb( i + 1 ) ;
random_shuffle( vi ) ;
random_suffle( vi ) ;
int a = getLightest( vi[ 0 ] , vi[ 1 ] , vi[ 2 ] ) ;
int b = getMedian( vi[ 0 ] , vi[ 1 ] , vi[ 2 ] ) ;
int c = vi[ 0 ] + vi[ 1 ] + vi[ 2 ] - a - b ;
int d = getLightest( vi[ 3 ] , vi[ 4 ] , vi[ 5 ] ) ;
int e = getMedian( vi[ 3 ] , vi[ 4 ] , vi[ 5 ] ) ;
int f = vi[ 3 ] + vi[ 4 ] + vi[ 5 ] - d - e ;
int d1 , e1 , f1 , x ;
// d1
x = getNextLightest( a , b , c , d ) ;
if( x != a ){
if( x == b ) d1 = 1 ;
if( x == c ) d1 = 2 ;
}
else{
x = getHeaviest( b , c , d ) ;
if( x == d ) d1 = 3 ;
else d1 = 0 ;
}
if( d1 == 3 ){
e1 = 3 ; f1 = 3 ;
}
else{
// e1
x = getNextLightest( a , b , c , e ) ;
if( x != a ){
if( x == b ) e1 = 1 ;
if( x == c ) e1 = 2 ;
}
else{
if( d1 != 0 ){
e1 = 3 ;
}
else{
x = getHeaviest( b , c , e ) ;
if( x == e ) e1 = 3 ;
else e1 = 0 ; }
}
if( e1 == 3 ){
f1 = 3 ;
}
else{
// f1
x = getNextLightest( a , b , c , f ) ;
if( x != a ){
if( x == b ) f1 = 1 ;
if( x == c ) f1 = 2 ;
}
else{
if( e1 != 0 ){
f1 =3 ;
}
else{
x = getHeaviest( b , c , f ) ;
if( x == f ) f1 = 3 ;
else f1 = 0 ; }
}
}
}
// now answer
vector < int > v ;
if( d1 == 0 ) v.pb( d ) ;
if( e1 == 0 ) v.pb( e ) ;
if( f1 == 0 ) v.pb( f ) ;
v.pb( a ) ;
if( d1 == 1 ) v.pb( d ) ;
if( e1 == 1 ) v.pb( e ) ;
if( f1 == 1 ) v.pb( f ) ;
v.pb( b ) ;
if( d1 == 2 ) v.pb( d ) ;
if( e1 == 2 ) v.pb( e ) ;
if( f1 == 2 ) v.pb( f ) ;
v.pb( c ) ;
if( d1 == 3 ) v.pb( d ) ;
if( e1 == 3 ) v.pb( e ) ;
if( f1 == 3 ) v.pb( f ) ;
// for( auto x : v ) cout << x << endl ;
int W[] = { v[ 0 ] , v[ 1 ] , v[ 2 ] , v[ 3 ] , v[ 4 ] , v[ 5 ] } ;
answer( W ) ;
}