Submission #783375

#TimeUsernameProblemLanguageResultExecution timeMemory
783375shezittScales (IOI15_scales)C++14
0 / 100
2 ms440 KiB
#include <bits/stdc++.h>
#include <scales.h>
using namespace std;

#define sz(x) (int) x.size()
#define dbg(x) cout << #x << ": " << x << endl;

using ll = long long;

void orderCoins(){
	set<int> lista = {1, 2, 3, 4, 5, 6};
	int a, b, c, d, e, z;
	// encontrando a
	int x = getLightest(1, 2, 3);
	int y = getLightest(4, 5, 6);
	int aux;
	for(auto xx : lista){
		if(xx != x && xx != y){
			aux = xx;
			break;
		}
	}
	a = getLightest(x, y, aux);
	
	lista.erase(a);
	
	// encontrando b
	// 2 3 4 5 6 
	auto it = lista.begin();
	x = getLightest(*it, *(++it), *(++it));
	b = getLightest(x, *(++it), *(++it));
	
	lista.erase(b);
	
	// encontrando z
	// 3 4 5 6 
	it = lista.begin();
	x = getHeaviest(*it, *(++it), *(++it));
	z = getHeaviest(x, *(++it), a);
	
	lista.erase(z);
	
	// encontrando c
	// 4 5 6 
	it = lista.begin();
	c = getLightest(*it, *(++it), *(++it));
	lista.erase(c);
	
	// encontrando d
	// 5 6 
	it = lista.begin();
	d = getLightest(*it, *(++it), z);
	lista.erase(d);
	
	// sobra e
	// 6
	e = *lista.begin();
	
	int xd[] = {a, b, c, d, e, z};
	
	answer(xd);
	
	
}

void init(int T){
	while(T--){
		orderCoins();
	}	
}

Compilation message (stderr)

scales.cpp: In function 'void orderCoins()':
scales.cpp:23:17: warning: 'aux' may be used uninitialized in this function [-Wmaybe-uninitialized]
   23 |  a = getLightest(x, y, aux);
      |      ~~~~~~~~~~~^~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...