Submission #345033

#TimeUsernameProblemLanguageResultExecution timeMemory
345033pggpScales (IOI15_scales)C++14
0 / 100
1 ms512 KiB
#include <bits/stdc++.h>
#include "scales.h"

using namespace std;

void init(int T){

}

void orderCoins(){
	vector < int > ans;
	vector < int > to_do;
	to_do.push_back(1);
	to_do.push_back(2);
	to_do.push_back(3);
	to_do.push_back(4);
	to_do.push_back(5);
	to_do.push_back(6);
	while(!to_do.empty()){
		if(to_do.size() == 3){
			int a = getHeaviest(to_do[0], to_do[1], to_do[2]);
			int b = getMedian(to_do[0], to_do[1], to_do[2]);
			int c = getLightest(to_do[0], to_do[1], to_do[2]);
			ans.push_back(a);
			ans.push_back(b);
			ans.push_back(c);
			break;
		}
		else{
			int h = getHeaviest(to_do[0], to_do[1], to_do[2]);
			int m = getMedian(to_do[0], to_do[1], to_do[2]);
			for (int i = 3; i < to_do.size(); ++i)
			{
				h = getHeaviest(h, m, to_do[i]);
			}
			ans.push_back(h);
			int ind;
			for (int i = 0; i < to_do.size(); ++i)
			{
				if(to_do[i] == h){
					ind = i;
				}
			}
			to_do.erase(to_do.begin() + ind);
		}
	}
	int ans1[6];
	for (int i = 0; i < 6; ++i)
	{
		ans1[i] = ans[i];
	}
	answer(ans1);
}

Compilation message (stderr)

scales.cpp: In function 'void init(int)':
scales.cpp:6:15: warning: unused parameter 'T' [-Wunused-parameter]
    6 | void init(int T){
      |           ~~~~^
scales.cpp: In function 'void orderCoins()':
scales.cpp:32:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   32 |    for (int i = 3; i < to_do.size(); ++i)
      |                    ~~^~~~~~~~~~~~~~
scales.cpp:38:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   38 |    for (int i = 0; i < to_do.size(); ++i)
      |                    ~~^~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...