nicegift.cpp: In function 'int main()':
nicegift.cpp:26:16: error: 'cur' was not declared in this scope
for (; cur.size() < k; ++it)
^~~
nicegift.cpp:26:34: error: 'it' was not declared in this scope
for (; cur.size() < k; ++it)
^~
nicegift.cpp:26:34: note: suggested alternative: 'i'
for (; cur.size() < k; ++it)
^~
i
nicegift.cpp:29:13: error: 'mn' was not declared in this scope
mn = min(mn, it->first);
^~
nicegift.cpp:29:13: note: suggested alternative: 'mx'
mn = min(mn, it->first);
^~
mx
nicegift.cpp:31:13: error: 'it' was not declared in this scope
if (it != a.rend())
^~
nicegift.cpp:31:13: note: suggested alternative: 'i'
if (it != a.rend())
^~
i
nicegift.cpp:32:13: error: 'mn' was not declared in this scope
mn = min(mn, max(sum / k - it->first - 1, 1));
^~
nicegift.cpp:32:13: note: suggested alternative: 'mx'
mn = min(mn, max(sum / k - it->first - 1, 1));
^~
mx
nicegift.cpp:33:14: error: 'mn' was not declared in this scope
if (!mn) throw;
^~
nicegift.cpp:33:14: note: suggested alternative: 'mx'
if (!mn) throw;
^~
mx
nicegift.cpp:48:21: error: 'cur' was not declared in this scope
for (int x: cur)
^~~
nicegift.cpp:51:33: error: 'mn' was not declared in this scope
a.insert({arr[x] -= mn, x});
^~
nicegift.cpp:51:33: note: suggested alternative: 'mx'
a.insert({arr[x] -= mn, x});
^~
mx
nicegift.cpp:51:39: error: no matching function for call to 'std::multiset<std::pair<long long int, int> >::insert(<brace-enclosed initializer list>)'
a.insert({arr[x] -= mn, x});
^
In file included from /usr/include/c++/7/set:62:0,
from nicegift.cpp:7:
/usr/include/c++/7/bits/stl_multiset.h:492:7: note: candidate: std::multiset<_Key, _Compare, _Alloc>::iterator std::multiset<_Key, _Compare, _Alloc>::insert(const value_type&) [with _Key = std::pair<long long int, int>; _Compare = std::less<std::pair<long long int, int> >; _Alloc = std::allocator<std::pair<long long int, int> >; std::multiset<_Key, _Compare, _Alloc>::iterator = std::_Rb_tree_const_iterator<std::pair<long long int, int> >; std::multiset<_Key, _Compare, _Alloc>::value_type = std::pair<long long int, int>]
insert(const value_type& __x)
^~~~~~
/usr/include/c++/7/bits/stl_multiset.h:492:7: note: no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const value_type& {aka const std::pair<long long int, int>&}'
/usr/include/c++/7/bits/stl_multiset.h:497:7: note: candidate: std::multiset<_Key, _Compare, _Alloc>::iterator std::multiset<_Key, _Compare, _Alloc>::insert(std::multiset<_Key, _Compare, _Alloc>::value_type&&) [with _Key = std::pair<long long int, int>; _Compare = std::less<std::pair<long long int, int> >; _Alloc = std::allocator<std::pair<long long int, int> >; std::multiset<_Key, _Compare, _Alloc>::iterator = std::_Rb_tree_const_iterator<std::pair<long long int, int> >; std::multiset<_Key, _Compare, _Alloc>::value_type = std::pair<long long int, int>]
insert(value_type&& __x)
^~~~~~
/usr/include/c++/7/bits/stl_multiset.h:497:7: note: no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::multiset<std::pair<long long int, int> >::value_type&& {aka std::pair<long long int, int>&&}'
/usr/include/c++/7/bits/stl_multiset.h:522:7: note: candidate: std::multiset<_Key, _Compare, _Alloc>::iterator std::multiset<_Key, _Compare, _Alloc>::insert(std::multiset<_Key, _Compare, _Alloc>::const_iterator, const value_type&) [with _Key = std::pair<long long int, int>; _Compare = std::less<std::pair<long long int, int> >; _Alloc = std::allocator<std::pair<long long int, int> >; std::multiset<_Key, _Compare, _Alloc>::iterator = std::_Rb_tree_const_iterator<std::pair<long long int, int> >; std::multiset<_Key, _Compare, _Alloc>::const_iterator = std::_Rb_tree_const_iterator<std::pair<long long int, int> >; std::multiset<_Key, _Compare, _Alloc>::value_type = std::pair<long long int, int>]
insert(const_iterator __position, const value_type& __x)
^~~~~~
/usr/include/c++/7/bits/stl_multiset.h:522:7: note: candidate expects 2 arguments, 1 provided
/usr/include/c++/7/bits/stl_multiset.h:527:7: note: candidate: std::multiset<_Key, _Compare, _Alloc>::iterator std::multiset<_Key, _Compare, _Alloc>::insert(std::multiset<_Key, _Compare, _Alloc>::const_iterator, std::multiset<_Key, _Compare, _Alloc>::value_type&&) [with _Key = std::pair<long long int, int>; _Compare = std::less<std::pair<long long int, int> >; _Alloc = std::allocator<std::pair<long long int, int> >; std::multiset<_Key, _Compare, _Alloc>::iterator = std::_Rb_tree_const_iterator<std::pair<long long int, int> >; std::multiset<_Key, _Compare, _Alloc>::const_iterator = std::_Rb_tree_const_iterator<std::pair<long long int, int> >; std::multiset<_Key, _Compare, _Alloc>::value_type = std::pair<long long int, int>]
insert(const_iterator __position, value_type&& __x)
^~~~~~
/usr/include/c++/7/bits/stl_multiset.h:527:7: note: candidate expects 2 arguments, 1 provided
/usr/include/c++/7/bits/stl_multiset.h:541:2: note: candidate: template<class _InputIterator> void std::multiset<_Key, _Compare, _Alloc>::insert(_InputIterator, _InputIterator) [with _InputIterator = _InputIterator; _Key = std::pair<long long int, int>; _Compare = std::less<std::pair<long long int, int> >; _Alloc = std::allocator<std::pair<long long int, int> >]
insert(_InputIterator __first, _InputIterator __last)
^~~~~~
/usr/include/c++/7/bits/stl_multiset.h:541:2: note: template argument deduction/substitution failed:
nicegift.cpp:51:39: note: candidate expects 2 arguments, 1 provided
a.insert({arr[x] -= mn, x});
^
In file included from /usr/include/c++/7/set:62:0,
from nicegift.cpp:7:
/usr/include/c++/7/bits/stl_multiset.h:553:7: note: candidate: void std::multiset<_Key, _Compare, _Alloc>::insert(std::initializer_list<_Tp>) [with _Key = std::pair<long long int, int>; _Compare = std::less<std::pair<long long int, int> >; _Alloc = std::allocator<std::pair<long long int, int> >]
insert(initializer_list<value_type> __l)
^~~~~~
/usr/include/c++/7/bits/stl_multiset.h:553:7: note: no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::initializer_list<std::pair<long long int, int> >'
/usr/include/c++/7/bits/stl_multiset.h:573:7: note: candidate: std::multiset<_Key, _Compare, _Alloc>::iterator std::multiset<_Key, _Compare, _Alloc>::insert(std::multiset<_Key, _Compare, _Alloc>::node_type&&) [with _Key = std::pair<long long int, int>; _Compare = std::less<std::pair<long long int, int> >; _Alloc = std::allocator<std::pair<long long int, int> >; std::multiset<_Key, _Compare, _Alloc>::iterator = std::_Rb_tree_const_iterator<std::pair<long long int, int> >; std::multiset<_Key, _Compare, _Alloc>::node_type = std::_Node_handle<std::pair<long long int, int>, std::pair<long long int, int>, std::allocator<std::_Rb_tree_node<std::pair<long long int, int> > > >]
insert(node_type&& __nh)
^~~~~~
/usr/include/c++/7/bits/stl_multiset.h:573:7: note: no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::multiset<std::pair<long long int, int> >::node_type&& {aka std::_Node_handle<std::pair<long long int, int>, std::pair<long long int, int>, std::allocator<std::_Rb_tree_node<std::pair<long long int, int> > > >&&}'
/usr/include/c++/7/bits/stl_multiset.h:578:7: note: candidate: std::multiset<_Key, _Compare, _Alloc>::iterator std::multiset<_Key, _Compare, _Alloc>::insert(std::multiset<_Key, _Compare, _Alloc>::const_iterator, std::multiset<_Key, _Compare, _Alloc>::node_type&&) [with _Key = std::pair<long long int, int>; _Compare = std::less<std::pair<long long int, int> >; _Alloc = std::allocator<std::pair<long long int, int> >; std::multiset<_Key, _Compare, _Alloc>::iterator = std::_Rb_tree_const_iterator<std::pair<long long int, int> >; std::multiset<_Key, _Compare, _Alloc>::const_iterator = std::_Rb_tree_const_iterator<std::pair<long long int, int> >; std::multiset<_Key, _Compare, _Alloc>::node_type = std::_Node_handle<std::pair<long long int, int>, std::pair<long long int, int>, std::allocator<std::_Rb_tree_node<std::pair<long long int, int> > > >]
insert(const_iterator __hint, node_type&& __nh)
^~~~~~
/usr/include/c++/7/bits/stl_multiset.h:578:7: note: candidate expects 2 arguments, 1 provided
nicegift.cpp:53:9: error: 'ans' was not declared in this scope
ans.push_back({mn, cur});
^~~
nicegift.cpp:53:9: note: suggested alternative: 'abs'
ans.push_back({mn, cur});
^~~
abs
nicegift.cpp:53:24: error: 'mn' was not declared in this scope
ans.push_back({mn, cur});
^~
nicegift.cpp:53:24: note: suggested alternative: 'mx'
ans.push_back({mn, cur});
^~
mx
nicegift.cpp:53:28: error: 'cur' was not declared in this scope
ans.push_back({mn, cur});
^~~
nicegift.cpp:59:13: error: 'ans' was not declared in this scope
cout << ans.size() << '\n';
^~~
nicegift.cpp:59:13: note: suggested alternative: 'abs'
cout << ans.size() << '\n';
^~~
abs
nicegift.cpp:60:18: error: unable to deduce 'auto&&' from 'ans'
for (auto x: ans)
^~~
nicegift.cpp:22:11: warning: unused variable 'mx' [-Wunused-variable]
llong mx = -1, sum = 0;
^~