#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=2e5+10;
vpl ma[N];
ll paid[N],dist[N][2];
bool vis[N][2];
// 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<=n;i++)
{
ma[i].clear();
paid[i]=0;
vis[i][0]=vis[i][1]=0;
dist[i][0]=dist[i][1]=1e18+10;
}
int m=U.size();
for(int i=0;i<m;i++)
{
ma[U[i]].push_back({W[i],V[i]});
ma[V[i]].push_back({W[i],U[i]});
}
priority_queue<ppll,vector<ppll>,greater<ppll>> pq;
pq.push({0,{0,x}});
pq.push({0,{1,y}});
dist[x][0]=0;
dist[y][1]=0;
ll cur=0;
while(pq.size()>0)
{
ppll it=pq.top();
pq.pop();
int u=it.second.second;
ll c=it.first;
int origin=it.second.first;
if(c!=dist[u][origin] or vis[u][origin])continue;
c-=paid[u];
c=max(0ll,c);
if((cur+c)>k)
continue;
cur+=c;
paid[u]+=c;
vis[u][origin]=0;
for(auto [w,v]:ma[u])
{
if(dist[v][origin]>(c+w))
{
dist[v][origin]=c+w;
pq.push({c+w,{origin,v}});
}
}
}
int total=0;
for(int i=0;i<n;i++)
{
total+=vis[i][0];
total+=vis[i][1];
}
return total;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
9820 KB |
1st lines differ - on the 1st token, expected: '6', found: '0' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
61 ms |
27584 KB |
1st lines differ - on the 1st token, expected: '451', found: '0' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
9820 KB |
1st lines differ - on the 1st token, expected: '3', found: '0' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
9820 KB |
1st lines differ - on the 1st token, expected: '3', found: '0' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
9820 KB |
1st lines differ - on the 1st token, expected: '3', found: '0' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
9820 KB |
1st lines differ - on the 1st token, expected: '6', found: '0' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
9820 KB |
1st lines differ - on the 1st token, expected: '6', found: '0' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
9820 KB |
1st lines differ - on the 1st token, expected: '6', found: '0' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
9820 KB |
1st lines differ - on the 1st token, expected: '6', found: '0' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
9820 KB |
1st lines differ - on the 1st token, expected: '6', found: '0' |
2 |
Halted |
0 ms |
0 KB |
- |