#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pll pair<ll,ll>
#define ppll pair<ll,pll>
#define vpl vector<pll>
const int N=5e5+10;
vpl ma[N];
ll paid[N],dist[N];
bool vis[N];
// ll dist_[2][N];
int max_score(int n, int x, int y, long long k, std::vector<int> U,std::vector<int> V, std::vector<int> W)
{
for(int i=0;i<2*n;i++)
{
ma[i].clear();
paid[i]=0;
vis[i]=0;
dist[i]=k+1;
}
int m=U.size();
for(int i=0;i<m;i++)
{
ma[U[i]].push_back({W[i],V[i]});
ma[U[i]+n].push_back({W[i],V[i]+n});
ma[V[i]].push_back({W[i],U[i]});
ma[V[i]+n].push_back({W[i],U[i]+n});
}
set<pll> pq;
pq.insert({0,x});
pq.insert({0,y+n});
dist[x]=0;
dist[y+n]=0;
ll cur=0;
while(pq.size()>0)
{
pll it=*pq.begin();
pq.erase(begin(pq));
int u=it.second;
ll c=it.first;
if(vis[u])continue;
c=max(0ll,c-paid[u])
if((cur+c)>k)
continue;
cur+=c;
if(u<n)
{
paid[u+n]+=c;
// if(!vis[u+n])
// {
// pq.erase({dist[u+n],u+n});
// dist[u+n]=max(0ll,(dist[u+n]-c));
// pq.insert({dist[u+n],u+n});
// }
}
else
{
paid[u-n]+=c;
// if(!vis[u-n])
// {
// pq.erase({dist[u-n],u-n});
// dist[u-n]=max(0ll,(dist[u-n]-c));
// pq.insert({dist[u-n],u-n});
// }
}
vis[u]=1;
for(auto [w,v]:ma[u])
{
ll cop=max(0ll,c+w);
if(dist[v]>(cop))
{
dist[v]=cop;
pq.insert({cop,v});
}
}
}
int total=0;
for(int i=0;i<2*n;i++)
{
total+=vis[i];
}
return total;
}
Compilation message
closing.cpp: In function 'int max_score(int, int, int, long long int, std::vector<int>, std::vector<int>, std::vector<int>)':
closing.cpp:47:29: error: expected ';' before 'if'
47 | c=max(0ll,c-paid[u])
| ^
| ;
48 |
49 | if((cur+c)>k)
| ~~