#include "swap.h"
#include<bits/stdc++.h>
#define pb push_back
#define ss second
#define ff first
using namespace std;
int l,r,i,j,ii,jj,k,n,m,mx,subtask=1;
vector< pair<int,int> > v[100000];
set< pair<int,int> > st;
void init(int N, int M, vector<int> U, vector<int> V, vector<int> W) {
n=N;
m=M;
for(i=0;i<M;i++){
v[U[i]].pb({V[i],W[i]});
v[V[i]].pb({U[i],W[i]});
mx=max(mx,W[i]);
st.insert({W[i],V[i]});
}
for(i=0;i<n;i++) if(v[i].size()>2) subtask=2;
}
int getMinimumFuelCapacity(int X, int Y) {
if(subtask==1){
if(n>m) return -1;
else return mx;
}
if(n<=3) return -1;
if(X==0 || Y==0){
if(Y==0) swap(X,Y);
st.erase({v[Y][0].ss,Y});
mx=v[Y][0].ss;
mx=max(mx,*(++st.begin()).ss);
st.insert({v[Y][0].ss,Y});
return mx;
}
else{
st.erase({v[X][0].ss,X});
st.erase({v[Y][0].ss,Y});
mx=max(v[X][0].ss,v[Y][0].ss);
mx=max(mx,(*st.begin()).ff);
st.insert({v[X][0].ss,X});
st.insert({v[Y][0].ss,Y});
return mx;
}
}
Compilation message
swap.cpp: In function 'int getMinimumFuelCapacity(int, int)':
swap.cpp:4:12: error: 'std::_Rb_tree_const_iterator<std::pair<int, int> >::_Self' has no member named 'second'
4 | #define ss second
| ^~~~~~
swap.cpp:32:35: note: in expansion of macro 'ss'
32 | mx=max(mx,*(++st.begin()).ss);
| ^~