Submission #261497

#TimeUsernameProblemLanguageResultExecution timeMemory
261497ElyesChaabouniScales (IOI15_scales)C++14
Compilation error
0 ms0 KiB
/*#pragma GCC optimize("O3")*/
#include<bits/stdc++.h>
#include"scales.h"
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp> 
//#define ordered_set tree<int, null_type,less<int >, rb_tree_tag,tree_order_statistics_node_update> 
#define eps 1e-9
#define MOD1 998244353
#define MOD2 1000000007
#define INV_10 299473306
#define INF 1000000001
#define PI 3.14159265358979323846
using namespace std;
void init(int T) {
    return;
}
vector<int> my_super_sort_function_that_never_fails(vector<int>v, int l, int r)
{
	vector<int>ans;
	if(v.size()<=1)
		return v;
	if(v.size()==2)
	{
		if(l!=-1)
		{
			int x=getHeaviest(l, v[0], v[1]);
			if(x==v[0])
				swap(v[0], v[1]);
			return v;
		}
		else
		{
			int x=getLightest(v[0], v[1], r);
			if(x==v[1])
				swap(v[0], v[1]);
			return v;
		}
	}
	if(v.size()==3)
	{
		set<int>s;
		s.insert(v[0]);
		s.insert(v[1]);
		s.insert(v[2]);
		ans.push_back(getLightest(v[0], v[1], v[2]));
		s.erase(v.back());
		ans.push_back(getMedian(v[0], v[1], v[2]));
		s.erase(v.back());
		ans.push_back(*s.begin());
		return ans;
	}
}
void orderCoins() {
	int a[3];
	set<int>s;
	s.insert(1);
	s.insert(2);
	s.insert(3);
	a[0]=getLightest(1, 2, 3);
	a[1]=getMedian(1, 2, 3);
	s.erase(a[0]);
	s.erase(a[1]);
	a[2]=*s.begin();
	vector<int>v1, v2, v3;
	for(int i = 4; i <= 6; i++)
	{
		int x=getMedian(a[0], a[1], i);
		if(x==a[0])
			v1.push_back(i);
		if(x==i)
			v2.push_back(i);
		if(x==a[1])
			v3.push_back(i);
	}
	v3.insert(a[2]);
	vector<int>vv1, vv2, vv3;
	vv1=my_super_sort_function_that_never_fails(v1, -1, a[0]);
	vv2=my_super_sort_function_that_never_fails(v2, a[0], a[1]);
	vv3=my_super_sort_function_that_never_fails(v3, a[1], -1);
	vector<int>ans;
	for(int i = 0; i < vv1.size(); i++)
		ans.push_back(vv1[i]);
	ans.push_back(a[0]);
	for(int i = 0; i < vv2.size(); i++)
		ans.push_back(vv2[i]);
	ans.push_back(a[1]);
	for(int i = 0; i < vv3.size(); i++)
		ans.push_back(vv3[i]);
	int pos=getNextLightest(4, 5, 6, a[2]);
	if(pos==ans[0])
	{
		ans.push_back(a[2]);
	}
	else
	{
		for(int j = 0; j < 5; j++)
		{
			if(ans[j]==pos)
			{
				ans.insert(ans.begin()+j, a[2]);
				break;
			}
		}
	}
	int ans1[6];
	for(int i = 0; i < 6; i++)
		ans1[i]=ans[i];
	answer(ans1);
}
//size

Compilation message (stderr)

scales.cpp: In function 'void init(int)':
scales.cpp:14:15: warning: unused parameter 'T' [-Wunused-parameter]
 void init(int T) {
               ^
scales.cpp: In function 'void orderCoins()':
scales.cpp:75:16: error: no matching function for call to 'std::vector<int>::insert(int&)'
  v3.insert(a[2]);
                ^
In file included from /usr/include/c++/7/vector:69:0,
                 from /usr/include/c++/7/queue:61,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:86,
                 from scales.cpp:2:
/usr/include/c++/7/bits/vector.tcc:114:5: note: candidate: std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::insert(std::vector<_Tp, _Alloc>::const_iterator, const value_type&) [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::iterator = __gnu_cxx::__normal_iterator<int*, std::vector<int> >; typename std::_Vector_base<_Tp, _Alloc>::pointer = int*; std::vector<_Tp, _Alloc>::const_iterator = __gnu_cxx::__normal_iterator<const int*, std::vector<int> >; typename __gnu_cxx::__alloc_traits<typename std::_Vector_base<_Tp, _Alloc>::_Tp_alloc_type>::const_pointer = const int*; std::vector<_Tp, _Alloc>::value_type = int]
     vector<_Tp, _Alloc>::
     ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/7/bits/vector.tcc:114:5: note:   candidate expects 2 arguments, 1 provided
In file included from /usr/include/c++/7/vector:64:0,
                 from /usr/include/c++/7/queue:61,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:86,
                 from scales.cpp:2:
/usr/include/c++/7/bits/stl_vector.h:1042:7: note: candidate: std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::insert(std::vector<_Tp, _Alloc>::const_iterator, std::vector<_Tp, _Alloc>::value_type&&) [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::iterator = __gnu_cxx::__normal_iterator<int*, std::vector<int> >; typename std::_Vector_base<_Tp, _Alloc>::pointer = int*; std::vector<_Tp, _Alloc>::const_iterator = __gnu_cxx::__normal_iterator<const int*, std::vector<int> >; typename __gnu_cxx::__alloc_traits<typename std::_Vector_base<_Tp, _Alloc>::_Tp_alloc_type>::const_pointer = const int*; std::vector<_Tp, _Alloc>::value_type = int]
       insert(const_iterator __position, value_type&& __x)
       ^~~~~~
/usr/include/c++/7/bits/stl_vector.h:1042:7: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/7/bits/stl_vector.h:1059:7: note: candidate: std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::insert(std::vector<_Tp, _Alloc>::const_iterator, std::initializer_list<_Tp>) [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::iterator = __gnu_cxx::__normal_iterator<int*, std::vector<int> >; typename std::_Vector_base<_Tp, _Alloc>::pointer = int*; std::vector<_Tp, _Alloc>::const_iterator = __gnu_cxx::__normal_iterator<const int*, std::vector<int> >; typename __gnu_cxx::__alloc_traits<typename std::_Vector_base<_Tp, _Alloc>::_Tp_alloc_type>::const_pointer = const int*]
       insert(const_iterator __position, initializer_list<value_type> __l)
       ^~~~~~
/usr/include/c++/7/bits/stl_vector.h:1059:7: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/7/bits/stl_vector.h:1084:7: note: candidate: std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::insert(std::vector<_Tp, _Alloc>::const_iterator, std::vector<_Tp, _Alloc>::size_type, const value_type&) [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::iterator = __gnu_cxx::__normal_iterator<int*, std::vector<int> >; typename std::_Vector_base<_Tp, _Alloc>::pointer = int*; std::vector<_Tp, _Alloc>::const_iterator = __gnu_cxx::__normal_iterator<const int*, std::vector<int> >; typename __gnu_cxx::__alloc_traits<typename std::_Vector_base<_Tp, _Alloc>::_Tp_alloc_type>::const_pointer = const int*; std::vector<_Tp, _Alloc>::size_type = long unsigned int; std::vector<_Tp, _Alloc>::value_type = int]
       insert(const_iterator __position, size_type __n, const value_type& __x)
       ^~~~~~
/usr/include/c++/7/bits/stl_vector.h:1084:7: note:   candidate expects 3 arguments, 1 provided
/usr/include/c++/7/bits/stl_vector.h:1128:2: note: candidate: template<class _InputIterator, class> std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::insert(std::vector<_Tp, _Alloc>::const_iterator, _InputIterator, _InputIterator) [with _InputIterator = _InputIterator; <template-parameter-2-2> = <template-parameter-1-2>; _Tp = int; _Alloc = std::allocator<int>]
  insert(const_iterator __position, _InputIterator __first,
  ^~~~~~
/usr/include/c++/7/bits/stl_vector.h:1128:2: note:   template argument deduction/substitution failed:
scales.cpp:75:16: note:   candidate expects 3 arguments, 1 provided
  v3.insert(a[2]);
                ^
scales.cpp:81:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i = 0; i < vv1.size(); i++)
                 ~~^~~~~~~~~~~~
scales.cpp:84:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i = 0; i < vv2.size(); i++)
                 ~~^~~~~~~~~~~~
scales.cpp:87:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i = 0; i < vv3.size(); i++)
                 ~~^~~~~~~~~~~~
scales.cpp: In function 'std::vector<int> my_super_sort_function_that_never_fails(std::vector<int>, int, int)':
scales.cpp:52:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^