#include "swap.h"
#include <bits/stdc++.h>
using namespace std;
#define all(a) begin(a),end(a)
const int mxN = (int)3e5+10;
multiset<int> S;
int edge[mxN];
void init(int N, int M, vector<int> U, vector<int> V, vector<int> W) {
for(auto u : W) S.insert(u);
for(int i = 0; i < M; i++)
edge[V[i]] = W[i];
}
int getMinimumFuelCapacity(int X, int Y) {
int ans = 0;
if(X==0){
ans = max(ans, edge[Y]);
S.erase(S.find(edge[Y]));
if(sz(S)<2) return -1;
ans = max(ans, *next(begin(S)));
S.insert(edge[Y]);
}
else{
ans = max(ans, edge[X]);
ans = max(ans, edge[Y]);
S.erase(S.find(edge[X]));
S.erase(S.find(edge[Y]));
if(S.empty()) return -1;
ans = max(ans, *begin(S));
S.insert(edge[X]);
S.insert(edge[Y]);
}
return ans;
}
Compilation message
swap.cpp: In function 'int getMinimumFuelCapacity(int, int)':
swap.cpp:22:6: error: 'sz' was not declared in this scope
22 | if(sz(S)<2) return -1;
| ^~