Submission #358075

#TimeUsernameProblemLanguageResultExecution timeMemory
358075amunduzbaevScales (IOI15_scales)C++14
55.56 / 100
1 ms492 KiB
#include "scales.h"

#ifndef EVAL
#include "grader.cpp"
#endif

#include "bits/stdc++.h"
using namespace std;
#define sz(x) (int)x.size()
#define pb push_back

void init(int T) {
    
}

void orderCoins(){
	vector<int> res = {1, 2, 3, 4, 5, 6}, ans; 
	vector<int>::iterator x;
	
	assert(sz(res) == 6);
	
	int a = res[0], b = res[1], c = res[2];
	int mn = getLightest(a, b, c);
	a = res[5], b = res[3], c = res[4];
	int mm = getLightest(a, b, c);
	int in = 0;
	while(res[in] == mn && in < 3) in++;
	int tm = mn;
	mn = getLightest(mn, mm, res[in]);
	ans.pb(mn);
	for(x = res.begin(); x != res.end(); x++) if((*x) == mn) break;
	res.erase(x);
	
	if(mn == mm){
		a = tm, b = res[sz(res)-1], c = res[sz(res)-2];
		mn = getLightest(a, b, c);
		ans.pb(mn);
		for(x = res.begin(); x!=res.end(); x++) if((*x) == mn) break;
		res.erase(x);
	}else{
		a = mm, b = res[0], c = res[1];
		mn = getLightest(a, b, c);
		ans.pb(mn);
		for(x = res.begin(); x!=res.end(); x++) if((*x) == mn) break;
		res.erase(x);
	}
	
	assert(sz(res) == 4);
	
	a = res[0], b = res[1], c = res[2];
	mn = getLightest(a, b, c);
	in = 0;
	while(res[in] == mn && in < 3) in++;
	mn = getLightest(mn, res[in], res[3]);
	ans.pb(mn);
	for(x = res.begin(); x!=res.end(); x++) if((*x) == mn) break;
	res.erase(x);
	assert(sz(res) == 3);
	
	a = res[0], b = res[1], c = res[2];
	int tta, ttb;
	mn = getLightest(a, b, c);
	ans.pb(mn);
	tta = mn;
	
	mn = getMedian(a, b, c);
	ans.pb(mn);
	ttb = mn;
	
	if(a != tta && a != ttb) ans.pb(a);
	else if(b != tta && b != ttb) ans.pb(b);
	else if(c != tta && c != ttb) ans.pb(c);
    int w[6];
    
    for(int i=0;i<6;i++) w[i] = ans[i];
    answer(w);
}

Compilation message (stderr)

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