Submission #783828

#TimeUsernameProblemLanguageResultExecution timeMemory
783828lollipopScales (IOI15_scales)C++17
55.56 / 100
1 ms224 KiB
#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"


//#define MAXN 6
//#define MAX_ANSWER_CALLS 1
//
//static int realC[MAXN];
//static int ind[MAXN];
//static int numQueries;
//static int numAnswerCalls;
//
//static int array[300];
//static int arraySize;
//static int ptr;
// void initNewTest() {
//  for (int i = 0; i < MAXN; i++) {
//    cin >> realC[ i ] ; 
//    realC[i]--;
//    ind[realC[i]] = i;
//  }
//
//  numQueries = 0;
//  numAnswerCalls = 0;
//}
//
//void answer(int C[]) {
//  int i;
//
//  numAnswerCalls++;
//  if (numAnswerCalls > MAX_ANSWER_CALLS)
//    return;
//
//  for (i = 0; i < 6; i++)
//    printf("%d ", C[i]);
//  printf("%d\n", numQueries);
//}
//
////static void checkQuery(int A, int B, int C, int D) {
////  if (D == -1) {
////    if (A < 1 || A > 6 || B < 1 || B > 6 || C < 1 || C > 6)
////      assert(0);
////    if (A == B || B == C || A == C)
////      assert(0);
////  } else {
////    if (A < 1 || A > 6 || B < 1 || B > 6 || C < 1 || C > 6 || D < 1 || D > 6)
////      assert(0);
////    if (A == B || A == C || A == D || B == C || B == D || C == D)
////      assert(0);
////  }
////}
//
//int getMedian(int A, int B, int C) {
//  numQueries++;
// // checkQuery(A, B, C, -1);
//
//  A--;
//  B--;
//  C--;
//
//  if (ind[B] < ind[A] && ind[A] < ind[C])
//    return A + 1;
//
//  if (ind[C] < ind[A] && ind[A] < ind[B])
//    return A + 1;
//
//  if (ind[A] < ind[B] && ind[B] < ind[C])
//    return B + 1;
//
//  if (ind[C] < ind[B] && ind[B] < ind[A])
//    return B + 1;
//
//  return C + 1;
//}
//
//int getHeaviest(int A, int B, int C) {
//  numQueries++;
////  checkQuery(A, B, C, -1);
//
//  A--;
//  B--;
//  C--;
//
//  if (ind[A] > ind[B] && ind[A] > ind[C])
//    return A + 1;
//
//  if (ind[B] > ind[A] && ind[B] > ind[C])
//    return B + 1;
//
//  return C + 1;
//}
//
//int getLightest(int A, int B, int C) {
//  numQueries++;
// // checkQuery(A, B, C, -1);
//
//  A--;
//  B--;
//  C--;
//
//  if (ind[A] < ind[B] && ind[A] < ind[C])
//    return A + 1;
//
//  if (ind[B] < ind[A] && ind[B] < ind[C])
//    return B + 1;
//
//  return C + 1;
//}
//
//int getNextLightest(int A, int B, int C, int D) {
//  int allLess = 1;
//
//  numQueries++;
// // checkQuery(A, B, C, D);
//
//  A--;
//  B--;
//  C--;
//  D--;
//
//  if (ind[A] > ind[D] || ind[B] > ind[D] || ind[C] > ind[D])
//    allLess = 0;
//
//  if (allLess == 1) {
//    if (ind[A] < ind[B] && ind[A] < ind[C])
//      return A + 1;
//
//    if (ind[B] < ind[A] && ind[B] < ind[C])
//      return B + 1;
//
//    return C + 1;
//  }
//
//  if (ind[A] > ind[D]) {
//    if ((ind[A] < ind[B] || ind[B] < ind[D]) &&
//        (ind[A] < ind[C] || ind[C] < ind[D]))
//      return A + 1;
//  }
//
//  if (ind[B] > ind[D]) {
//    if ((ind[B] < ind[A] || ind[A] < ind[D]) &&
//        (ind[B] < ind[C] || ind[C] < ind[D]))
//      return B + 1;
//  }
//
//  return C + 1;
//}



void init(int T){
	 // heheh
	 
}
void orderCoins(){
	 int a = getLightest( 1 , 2 , 3 ) ;
	 int b = getMedian( 1 , 2 , 3 ) ;
	 int c = 6 - a - b ;
	 int d = 4 , e = 5 , f = 6 ; 
	 // for d 
	 int x = getNextLightest( a , b , c , d ) ;
	 if( x != a ){
	 	if( x == b ){
	 		swap( d , c ) ;
	 		swap( c , b ) ;
		}
		else{
		   swap( d , c ) ;	
		}
	 }
	 else{
	 	int y = getHeaviest( b , c , d ) ;
	 	if( y != d ){
	 		swap( d , c ) ;
	 		swap( c , b ) ;
	 		swap( b , a ) ;
		 }	
	 }
	 // for e 
	 x = getNextLightest( b , c , d , e ) ;
	 if( x != b ){
	 	if( x == c ){
	 		swap( e , d ) ;
	 		swap( d , c ) ;
		}
		else{
		   swap( e , d ) ;	
		}
	 }
	 else{
	 	int y = getMedian( a , b , e ) ;
	 	if( y == a ){
	 		swap( e , d ) ;
	 		swap( d , c ) ;
	 		swap( c , b ) ;
	 		swap( b , a ) ;
		 }	
		 else{
		 	if( y == e ){
		 		swap( e , d ) ;
		 		swap( d , c ) ;
		 		swap( c , b ) ; 
			 }
		 }
		 	
	 }	 
	 // for f
     x = getNextLightest( a , c , e , f ) ;	 
	 if( x == a ){
	 	 int y = getLightest( a , b , f ) ;
	 	 if( y == f ){
	 	 	swap( f , e ) ;
	 	 	swap( e , d ) ;
	 	 	swap( d , c ) ;
	 	 	swap( c , b ) ;
	 	 	swap( b , a ) ;
		 }
	 }
	 else{
	 	if( x == c ){
	 		int y = getMedian( a , b , f ) ;
	 		if( y == b ){
	 			swap( f , e ) ;
	 			swap( e , d ) ;
	 			swap( d , c ) ;
			}
			else{
	 			swap( f , e ) ;
	 			swap( e , d ) ;
	 			swap( d , c ) ;	
				swap( c , b ) ; 			
			}
		}
		else{
			int y = getMedian( d , e , f ) ;
		    if( y == f ){
		    	swap( f , e ) ;
			}
			else{
				swap( f , e ) ;
				swap( e , d ) ;
			}
			
		}
	 }
	 
	 
	 int W[] = { a , b , c , d , e , f } ; 
     answer( W ) ;
}

//
//int main() {
//
//
//  int T, i;
//
//  cin >> T ; 
//
//  init(T);
//
//  for (i = 1; i <= T; i++) {
//    initNewTest();
//    orderCoins();
//  }
//
//  return 0;
//}

Compilation message (stderr)

scales.cpp: In function 'void init(int)':
scales.cpp:181:15: warning: unused parameter 'T' [-Wunused-parameter]
  181 | void init(int T){
      |           ~~~~^
#Verdict Execution timeMemoryGrader output
Fetching results...