#include "closing.h"
#include <bits/stdc++.h>
#define ll long long
#define rep(a,b,c) for(int a=b; a<c; a++)
#define repa(a,b) for(auto a:b)
#define pll pair<ll, ll>
#define fi first
#define se second
#define pb push_back
using namespace std;
const int lim=2e5+5;
vector<pll> adj[lim];
bool vis[lim];
ll K2, a[lim];
int max_score(int N, int X, int Y, ll K, vector<int> U, vector<int> V, vector<int> W){
ll ans=0, dis[N];
rep(i,0,N) adj[i].clear(), dis[i]=3e18+5;
rep(i,0,N-1){
adj[U[i]].pb({V[i],W[i]});
adj[V[i]].pb({U[i],W[i]});
}
priority_queue<pll, vector<pll>, greater<pll>> pq;
pq.push({0,X});
pq.push({0,Y});
dis[X]=0;
dis[Y]=0;
while(pq.size()){
pll act=pq.top();
pq.pop();
if(act.fi>dis[act.se]) continue;
if(K>=act.fi) ans++, K-=act.fi;
else break;
repa(e,adj[act.se]){
if(dis[e.fi]>act.fi+e.se){
pq.push({act.fi+e.se,e.fi});
dis[e.fi]=act.fi+e.se;
}
}
}
return ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
3 ms |
6492 KB |
1st lines differ - on the 1st token, expected: '6', found: '5' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
69 ms |
23352 KB |
Output is correct |
2 |
Correct |
68 ms |
23392 KB |
Output is correct |
3 |
Correct |
40 ms |
9252 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
6492 KB |
Output is correct |
2 |
Incorrect |
1 ms |
6492 KB |
1st lines differ - on the 1st token, expected: '30', found: '17' |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
6492 KB |
Output is correct |
2 |
Incorrect |
1 ms |
6492 KB |
1st lines differ - on the 1st token, expected: '30', found: '17' |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
6492 KB |
Output is correct |
2 |
Incorrect |
1 ms |
6492 KB |
1st lines differ - on the 1st token, expected: '30', found: '17' |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
3 ms |
6492 KB |
1st lines differ - on the 1st token, expected: '6', found: '5' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
3 ms |
6492 KB |
1st lines differ - on the 1st token, expected: '6', found: '5' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
3 ms |
6492 KB |
1st lines differ - on the 1st token, expected: '6', found: '5' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
3 ms |
6492 KB |
1st lines differ - on the 1st token, expected: '6', found: '5' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
3 ms |
6492 KB |
1st lines differ - on the 1st token, expected: '6', found: '5' |
2 |
Halted |
0 ms |
0 KB |
- |