Submission #312370

#TimeUsernameProblemLanguageResultExecution timeMemory
312370YJUCake 3 (JOI19_cake3)C++14
Compilation error
0 ms0 KiB
#include<bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
using namespace std;
typedef long long lll;
typedef int ll;
typedef long double ld;
typedef pair<ll,ll> pll;
const ll MOD=1e9+7;
const ll MOD2=998244353;
const ll N=4e5+5;
const ll K=350;
const ld pi=3.14159265359;
const lll INF=(1LL<<60);
#define SQ(i) ((i)*(i))
#define REP(i,n) for(ll i=0;i<n;i++)
#define REP1(i,n) for(ll i=1;i<=n;i++)
#define pb push_back
#define mp make_pair
#define X first
#define Y second
#define setp setprecision
#define lwb lower_bound
#define SZ(_a) (ll)_a.size()
 
ll pl=1,pr=0,n,m,x,y;
lll ans=-INF,current=0;
multiset<ll> msa,msb;
vector<pll> v;
 
void add(ll id){
	msb.insert(v[id].X);
	while(SZ(msa)<m&&SZ(msb)){
		auto it=prev(msb.end());
		current+=*it;
		msa.insert(it);
		msb.erase(it);
	}
	while(SZ(msa)&&SZ(msb)&&*msa.begin()<*prev(msb.end())){
		auto tmpa=msa.begin(),tmpb=prev(msb.end());
		msa.erase(tmpa);msb.erase(tmpb);
		current=current-*tmpa+*tmpb;
		msa.insert(tmpb);msb.insert(tmpa);
	}
}
 
void rem(ll id){
	if(msa.find(v[id].X)!=msa.end())current-=v[id].X,msa.erase(msa.find(v[id].X));
	else msb.erase(msb.find(v[id].X));
	while(SZ(msa)<m&&SZ(msb)){
		auto it=prev(msb.end());
		current+=*it;
		msa.insert(it);
		msb.erase(it);
	}
	while(SZ(msa)&&SZ(msb)&&*msa.begin()<*prev(msb.end())){
		auto tmpa=msa.begin(),tmpb=prev(msb.end());
		msa.erase(tmpa);msb.erase(tmpb);
		current=current-*tmpa+*tmpb;
		msa.insert(tmpb);msb.insert(tmpa);
	}
}
 
void get_ans(ll l,ll r){
	++l;--r;
	while(pl>l){add(--pl);}
	while(pr<r){add(++pr);}
	while(pl<l){rem(pl++);}
	while(pr>r){rem(pr--);}
}
 
void solve(ll ql,ll qr,ll al,ll ar){
	if(ql>qr)return ;
	ll mid=(ql+qr)/2;
	
	msa.clear();msb.clear();current=0;
	pl=mid;pr=mid-1;
	
	lll bans=-INF,bpos=al;
	for(int i=min(mid-1,ar);i>=al;i--){
		get_ans(i,mid);
		lll tans=(SZ(msa)<m?-INF:current-2*(v[mid].Y-v[i].Y)+v[mid].X+v[i].X);
		if(tans>bans){
			bpos=i,bans=tans;
		}
		ans=max(ans,tans);
	}
	solve(ql,mid-1,al,bpos);
	solve(mid+1,qr,bpos,ar);
}
 
int main(){
	ios_base::sync_with_stdio(0);cin.tie(0);
	cin>>n>>m;
	m-=2;
	REP(i,n)cin>>x>>y,v.pb(mp(x,y));
	sort(v.begin(),v.end(),[](pll a,pll b){
		return (a.Y!=b.Y?a.Y<b.Y:a.X>b.X);	
	});
	solve(0,n-1,0,n-1);
	cout<<ans<<"\n";
	return 0;
}

Compilation message (stderr)

cake3.cpp: In function 'void add(ll)':
cake3.cpp:35:16: error: no matching function for call to 'std::multiset<int>::insert(std::_Rb_tree_const_iterator<int>&)'
   35 |   msa.insert(it);
      |                ^
In file included from /usr/include/c++/9/set:62,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:87,
                 from cake3.cpp:1:
/usr/include/c++/9/bits/stl_multiset.h:502:7: note: candidate: 'std::multiset<_Key, _Compare, _Alloc>::iterator std::multiset<_Key, _Compare, _Alloc>::insert(const value_type&) [with _Key = int; _Compare = std::less<int>; _Alloc = std::allocator<int>; std::multiset<_Key, _Compare, _Alloc>::iterator = std::_Rb_tree_const_iterator<int>; std::multiset<_Key, _Compare, _Alloc>::value_type = int]'
  502 |       insert(const value_type& __x)
      |       ^~~~~~
/usr/include/c++/9/bits/stl_multiset.h:502:32: note:   no known conversion for argument 1 from 'std::_Rb_tree_const_iterator<int>' to 'const value_type&' {aka 'const int&'}
  502 |       insert(const value_type& __x)
      |              ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/9/bits/stl_multiset.h:507:7: note: candidate: 'std::multiset<_Key, _Compare, _Alloc>::iterator std::multiset<_Key, _Compare, _Alloc>::insert(std::multiset<_Key, _Compare, _Alloc>::value_type&&) [with _Key = int; _Compare = std::less<int>; _Alloc = std::allocator<int>; std::multiset<_Key, _Compare, _Alloc>::iterator = std::_Rb_tree_const_iterator<int>; std::multiset<_Key, _Compare, _Alloc>::value_type = int]'
  507 |       insert(value_type&& __x)
      |       ^~~~~~
/usr/include/c++/9/bits/stl_multiset.h:507:27: note:   no known conversion for argument 1 from 'std::_Rb_tree_const_iterator<int>' to 'std::multiset<int>::value_type&&' {aka 'int&&'}
  507 |       insert(value_type&& __x)
      |              ~~~~~~~~~~~~~^~~
/usr/include/c++/9/bits/stl_multiset.h:532: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 = int; _Compare = std::less<int>; _Alloc = std::allocator<int>; std::multiset<_Key, _Compare, _Alloc>::iterator = std::_Rb_tree_const_iterator<int>; std::multiset<_Key, _Compare, _Alloc>::const_iterator = std::_Rb_tree_const_iterator<int>; std::multiset<_Key, _Compare, _Alloc>::value_type = int]'
  532 |       insert(const_iterator __position, const value_type& __x)
      |       ^~~~~~
/usr/include/c++/9/bits/stl_multiset.h:532:7: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/9/bits/stl_multiset.h:537: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 = int; _Compare = std::less<int>; _Alloc = std::allocator<int>; std::multiset<_Key, _Compare, _Alloc>::iterator = std::_Rb_tree_const_iterator<int>; std::multiset<_Key, _Compare, _Alloc>::const_iterator = std::_Rb_tree_const_iterator<int>; std::multiset<_Key, _Compare, _Alloc>::value_type = int]'
  537 |       insert(const_iterator __position, value_type&& __x)
      |       ^~~~~~
/usr/include/c++/9/bits/stl_multiset.h:537:7: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/9/bits/stl_multiset.h:551:2: note: candidate: 'template<class _InputIterator> void std::multiset<_Key, _Compare, _Alloc>::insert(_InputIterator, _InputIterator) [with _InputIterator = _InputIterator; _Key = int; _Compare = std::less<int>; _Alloc = std::allocator<int>]'
  551 |  insert(_InputIterator __first, _InputIterator __last)
      |  ^~~~~~
/usr/include/c++/9/bits/stl_multiset.h:551:2: note:   template argument deduction/substitution failed:
cake3.cpp:35:16: note:   candidate expects 2 arguments, 1 provided
   35 |   msa.insert(it);
      |                ^
In file included from /usr/include/c++/9/set:62,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:87,
                 from cake3.cpp:1:
/usr/include/c++/9/bits/stl_multiset.h:563:7: note: candidate: 'void std::multiset<_Key, _Compare, _Alloc>::insert(std::initializer_list<_Tp>) [with _Key = int; _Compare = std::less<int>; _Alloc = std::allocator<int>]'
  563 |       insert(initializer_list<value_type> __l)
      |       ^~~~~~
/usr/include/c++/9/bits/stl_multiset.h:563:43: note:   no known conversion for argument 1 from 'std::_Rb_tree_const_iterator<int>' to 'std::initializer_list<int>'
  563 |       insert(initializer_list<value_type> __l)
      |              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
cake3.cpp:42:18: error: no matching function for call to 'std::multiset<int>::insert(std::_Rb_tree_const_iterator<int>&)'
   42 |   msa.insert(tmpb);msb.insert(tmpa);
      |                  ^
In file included from /usr/include/c++/9/set:62,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:87,
                 from cake3.cpp:1:
/usr/include/c++/9/bits/stl_multiset.h:502:7: note: candidate: 'std::multiset<_Key, _Compare, _Alloc>::iterator std::multiset<_Key, _Compare, _Alloc>::insert(const value_type&) [with _Key = int; _Compare = std::less<int>; _Alloc = std::allocator<int>; std::multiset<_Key, _Compare, _Alloc>::iterator = std::_Rb_tree_const_iterator<int>; std::multiset<_Key, _Compare, _Alloc>::value_type = int]'
  502 |       insert(const value_type& __x)
      |       ^~~~~~
/usr/include/c++/9/bits/stl_multiset.h:502:32: note:   no known conversion for argument 1 from 'std::_Rb_tree_const_iterator<int>' to 'const value_type&' {aka 'const int&'}
  502 |       insert(const value_type& __x)
      |              ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/9/bits/stl_multiset.h:507:7: note: candidate: 'std::multiset<_Key, _Compare, _Alloc>::iterator std::multiset<_Key, _Compare, _Alloc>::insert(std::multiset<_Key, _Compare, _Alloc>::value_type&&) [with _Key = int; _Compare = std::less<int>; _Alloc = std::allocator<int>; std::multiset<_Key, _Compare, _Alloc>::iterator = std::_Rb_tree_const_iterator<int>; std::multiset<_Key, _Compare, _Alloc>::value_type = int]'
  507 |       insert(value_type&& __x)
      |       ^~~~~~
/usr/include/c++/9/bits/stl_multiset.h:507:27: note:   no known conversion for argument 1 from 'std::_Rb_tree_const_iterator<int>' to 'std::multiset<int>::value_type&&' {aka 'int&&'}
  507 |       insert(value_type&& __x)
      |              ~~~~~~~~~~~~~^~~
/usr/include/c++/9/bits/stl_multiset.h:532: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 = int; _Compare = std::less<int>; _Alloc = std::allocator<int>; std::multiset<_Key, _Compare, _Alloc>::iterator = std::_Rb_tree_const_iterator<int>; std::multiset<_Key, _Compare, _Alloc>::const_iterator = std::_Rb_tree_const_iterator<int>; std::multiset<_Key, _Compare, _Alloc>::value_type = int]'
  532 |       insert(const_iterator __position, const value_type& __x)
      |       ^~~~~~
/usr/include/c++/9/bits/stl_multiset.h:532:7: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/9/bits/stl_multiset.h:537: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 = int; _Compare = std::less<int>; _Alloc = std::allocator<int>; std::multiset<_Key, _Compare, _Alloc>::iterator = std::_Rb_tree_const_iterator<int>; std::multiset<_Key, _Compare, _Alloc>::const_iterator = std::_Rb_tree_const_iterator<int>; std::multiset<_Key, _Compare, _Alloc>::value_type = int]'
  537 |       insert(const_iterator __position, value_type&& __x)
      |       ^~~~~~
/usr/include/c++/9/bits/stl_multiset.h:537:7: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/9/bits/stl_multiset.h:551:2: note: candidate: 'template<class _InputIterator> void std::multiset<_Key, _Compare, _Alloc>::insert(_InputIterator, _InputIterator) [with _InputIterator = _InputIterator; _Key = int; _Compare = std::less<int>; _Alloc = std::allocator<int>]'
  551 |  insert(_InputIterator __first, _InputIterator __last)
      |  ^~~~~~
/usr/include/c++/9/bits/stl_multiset.h:551:2: note:   template argument deduction/substitution failed:
cake3.cpp:42:18: note:   candidate expects 2 arguments, 1 provided
   42 |   msa.insert(tmpb);msb.insert(tmpa);
      |                  ^
In file included from /usr/include/c++/9/set:62,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:87,
                 from cake3.cpp:1:
/usr/include/c++/9/bits/stl_multiset.h:563:7: note: candidate: 'void std::multiset<_Key, _Compare, _Alloc>::insert(std::initializer_list<_Tp>) [with _Key = int; _Compare = std::less<int>; _Alloc = std::allocator<int>]'
  563 |       insert(initializer_list<value_type> __l)
      |       ^~~~~~
/usr/include/c++/9/bits/stl_multiset.h:563:43: note:   no known conversion for argument 1 from 'std::_Rb_tree_const_iterator<int>' to 'std::initializer_list<int>'
  563 |       insert(initializer_list<value_type> __l)
      |              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
cake3.cpp:42:35: error: no matching function for call to 'std::multiset<int>::insert(std::_Rb_tree_const_iterator<int>&)'
   42 |   msa.insert(tmpb);msb.insert(tmpa);
      |                                   ^
In file included from /usr/include/c++/9/set:62,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:87,
                 from cake3.cpp:1:
/usr/include/c++/9/bits/stl_multiset.h:502:7: note: candidate: 'std::multiset<_Key, _Compare, _Alloc>::iterator std::multiset<_Key, _Compare, _Alloc>::insert(const value_type&) [with _Key = int; _Compare = std::less<int>; _Alloc = std::allocator<int>; std::multiset<_Key, _Compare, _Alloc>::iterator = std::_Rb_tree_const_iterator<int>; std::multiset<_Key, _Compare, _Alloc>::value_type = int]'
  502 |       insert(const value_type& __x)
      |       ^~~~~~
/usr/include/c++/9/bits/stl_multiset.h:502:32: note:   no known conversion for argument 1 from 'std::_Rb_tree_const_iterator<int>' to 'const value_type&' {aka 'const int&'}
  502 |       insert(const value_type& __x)
      |              ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/9/bits/stl_multiset.h:507:7: note: candidate: 'std::multiset<_Key, _Compare, _Alloc>::iterator std::multiset<_Key, _Compare, _Alloc>::insert(std::multiset<_Key, _Compare, _Alloc>::value_type&&) [with _Key = int; _Compare = std::less<int>; _Alloc = std::allocator<int>; std::multiset<_Key, _Compare, _Alloc>::iterator = std::_Rb_tree_const_iterator<int>; std::multiset<_Key, _Compare, _Alloc>::value_type = int]'
  507 |       insert(value_type&& __x)
      |       ^~~~~~
/usr/include/c++/9/bits/stl_multiset.h:507:27: note:   no known conversion for argument 1 from 'std::_Rb_tree_const_iterator<int>' to 'std::multiset<int>::value_type&&' {aka 'int&&'}
  507 |       insert(value_type&& __x)
      |              ~~~~~~~~~~~~~^~~
/usr/include/c++/9/bits/stl_multiset.h:532: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 = int; _Compare = std::less<int>; _Alloc = std::allocator<int>; std::multiset<_Key, _Compare, _Alloc>::iterator = std::_Rb_tree_const_iterator<int>; std::multiset<_Key, _Compare, _Alloc>::const_iterator = std::_Rb_tree_const_iterator<int>; std::multiset<_Key, _Compare, _Alloc>::value_type = int]'
  532 |       insert(const_iterator __position, const value_type& __x)
      |       ^~~~~~
/usr/include/c++/9/bits/stl_multiset.h:532:7: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/9/bits/stl_multiset.h:537: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 = int; _Compare = std::less<int>; _Alloc = std::allocator<int>; std::multiset<_Key, _Compare, _Alloc>::iterator = std::_Rb_tree_const_iterator<int>; std::multiset<_Key, _Compare, _Alloc>::const_iterator = std::_Rb_tree_const_iterator<int>; std::multiset<_Key, _Compare, _Alloc>::value_type = int]'
  537 |       insert(const_iterator __position, value_type&& __x)
      |       ^~~~~~
/usr/include/c++/9/bits/stl_multiset.h:537:7: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/9/bits/stl_multiset.h:551:2: note: candidate: 'template<class _InputIterator> void std::multiset<_Key, _Compare, _Alloc>::insert(_InputIterator, _InputIterator) [with _InputIterator = _InputIterator; _Key = int; _Compare = std::less<int>; _Alloc = std::allocator<int>]'
  551 |  insert(_InputIterator __first, _InputIterator __last)
      |  ^~~~~~
/usr/include/c++/9/bits/stl_multiset.h:551:2: note:   template argument deduction/substitution failed:
cake3.cpp:42:35: note:   candidate expects 2 arguments, 1 provided
   42 |   msa.insert(tmpb);msb.insert(tmpa);
      |                                   ^
In file included from /usr/include/c++/9/set:62,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:87,
                 from cake3.cpp:1:
/usr/include/c++/9/bits/stl_multiset.h:563:7: note: candidate: 'void std::multiset<_Key, _Compare, _Alloc>::insert(std::initializer_list<_Tp>) [with _Key = int; _Compare = std::less<int>; _Alloc = std::allocator<int>]'
  563 |       insert(initializer_list<value_type> __l)
      |       ^~~~~~
/usr/include/c++/9/bits/stl_multiset.h:563:43: note:   no known conversion for argument 1 from 'std::_Rb_tree_const_iterator<int>' to 'std::initializer_list<int>'
  563 |       insert(initializer_list<value_type> __l)
      |              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
cake3.cpp: In function 'void rem(ll)':
cake3.cpp:52:16: error: no matching function for call to 'std::multiset<int>::insert(std::_Rb_tree_const_iterator<int>&)'
   52 |   msa.insert(it);
      |                ^
In file included from /usr/include/c++/9/set:62,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:87,
                 from cake3.cpp:1:
/usr/include/c++/9/bits/stl_multiset.h:502:7: note: candidate: 'std::multiset<_Key, _Compare, _Alloc>::iterator std::multiset<_Key, _Compare, _Alloc>::insert(const value_type&) [with _Key = int; _Compare = std::less<int>; _Alloc = std::allocator<int>; std::multiset<_Key, _Compare, _Alloc>::iterator = std::_Rb_tree_const_iterator<int>; std::multiset<_Key, _Compare, _Alloc>::value_type = int]'
  502 |       insert(const value_type& __x)
      |       ^~~~~~
/usr/include/c++/9/bits/stl_multiset.h:502:32: note:   no known conversion for argument 1 from 'std::_Rb_tree_const_iterator<int>' to 'const value_type&' {aka 'const int&'}
  502 |       insert(const value_type& __x)
      |              ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/9/bits/stl_multiset.h:507:7: note: candidate: 'std::multiset<_Key, _Compare, _Alloc>::iterator std::multiset<_Key, _Compare, _Alloc>::insert(std::multiset<_Key, _Compare, _Alloc>::value_type&&) [with _Key = int; _Compare = std::less<int>; _Alloc = std::allocator<int>; std::multiset<_Key, _Compare, _Alloc>::iterator = std::_Rb_tree_const_iterator<int>; std::multiset<_Key, _Compare, _Alloc>::value_type = int]'
  507 |       insert(value_type&& __x)
      |       ^~~~~~
/usr/include/c++/9/bits/stl_multiset.h:507:27: note:   no known conversion for argument 1 from 'std::_Rb_tree_const_iterator<int>' to 'std::multiset<int>::value_type&&' {aka 'int&&'}
  507 |       insert(value_type&& __x)
      |              ~~~~~~~~~~~~~^~~
/usr/include/c++/9/bits/stl_multiset.h:532: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 = int; _Compare = std::less<int>; _Alloc = std::allocator<int>; std::multiset<_Key, _Compare, _Alloc>::iterator = std::_Rb_tree_const_iterator<int>; std::multiset<_Key, _Compare, _Alloc>::const_iterator = std::_Rb_tree_const_iterator<int>; std::multiset<_Key, _Compare, _Alloc>::value_type = int]'
  532 |       insert(const_iterator __position, const value_type& __x)
      |       ^~~~~~
/usr/include/c++/9/bits/stl_multiset.h:532:7: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/9/bits/stl_multiset.h:537: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 = int; _Compare = std::less<int>; _Alloc = std::allocator<int>; std::multiset<_Key, _Compare, _Alloc>::iterator = std::_Rb_tree_const_iterator<int>; std::multiset<_Key, _Compare, _Alloc>::const_iterator = std::_Rb_tree_const_iterator<int>; std::multiset<_Key, _Compare, _Alloc>::value_type = int]'
  537 |       insert(const_iterator __position, value_type&& __x)
      |       ^~~~~~
/usr/include/c++/9/bits/stl_multiset.h:537:7: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/9/bits/stl_multiset.h:551:2: note: candidate: 'template<class _InputIterator> void std::multiset<_Key, _Compare, _Alloc>::insert(_InputIterator, _InputIterator) [with _InputIterator = _InputIterator; _Key = int; _Compare = std::less<int>; _Alloc = std::allocator<int>]'
  551 |  insert(_InputIterator __first, _InputIterator __last)
      |  ^~~~~~
/usr/include/c++/9/bits/stl_multiset.h:551:2: note:   template argument deduction/substitution failed:
cake3.cpp:52:16: note:   candidate expects 2 arguments, 1 provided
   52 |   msa.insert(it);
      |                ^
In file included from /usr/include/c++/9/set:62,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:87,
                 from cake3.cpp:1:
/usr/include/c++/9/bits/stl_multiset.h:563:7: note: candidate: 'void std::multiset<_Key, _Compare, _Alloc>::insert(std::initializer_list<_Tp>) [with _Key = int; _Compare = std::less<int>; _Alloc = std::allocator<int>]'
  563 |       insert(initializer_list<value_type> __l)
      |       ^~~~~~
/usr/include/c++/9/bits/stl_multiset.h:563:43: note:   no known conversion for argument 1 from 'std::_Rb_tree_const_iterator<int>' to 'std::initializer_list<int>'
  563 |       insert(initializer_list<value_type> __l)
      |              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
cake3.cpp:59:18: error: no matching function for call to 'std::multiset<int>::insert(std::_Rb_tree_const_iterator<int>&)'
   59 |   msa.insert(tmpb);msb.insert(tmpa);
      |                  ^
In file included from /usr/include/c++/9/set:62,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:87,
                 from cake3.cpp:1:
/usr/include/c++/9/bits/stl_multiset.h:502:7: note: candidate: 'std::multiset<_Key, _Compare, _Alloc>::iterator std::multiset<_Key, _Compare, _Alloc>::insert(const value_type&) [with _Key = int; _Compare = std::less<int>; _Alloc = std::allocator<int>; std::multiset<_Key, _Compare, _Alloc>::iterator = std::_Rb_tree_const_iterator<int>; std::multiset<_Key, _Compare, _Alloc>::value_type = int]'
  502 |       insert(const value_type& __x)
      |       ^~~~~