| # | User | Rating |
|---|---|---|
| 1 | Benq | 3792 |
| 2 | VivaciousAubergine | 3647 |
| 3 | Kevin114514 | 3603 |
| 4 | jiangly | 3583 |
| 5 | strapple | 3515 |
| 6 | tourist | 3470 |
| 7 | dXqwq | 3436 |
| 8 | Radewoosh | 3415 |
| 9 | Otomachi_Una | 3413 |
| 10 | Um_nik | 3376 |
| # | User | Contrib. |
|---|---|---|
| 1 | Qingyu | 158 |
| 2 | adamant | 152 |
| 3 | Proof_by_QED | 146 |
| 3 | Um_nik | 146 |
| 5 | Dominater069 | 144 |
| 6 | errorgorn | 141 |
| 7 | cry | 139 |
| 8 | YuukiS | 135 |
| 9 | chromate00 | 134 |
| 9 | TheScrasse | 134 |
|
0
could someone explain why my code is failing in 26th test case this is for problem G ~~~~~ //Ram Ram include <bits/stdc++.h>include<ext/pb_ds/assoc_container.hpp>include<ext/pb_ds/tree_policy.hpp>using namespace std; using namespace __gnu_pbds; define ll long longdefine int long long intdefine _test int _TEST; cin>>_TEST; while(_TEST--)define ff firstdefine ss seconddefine pb push_backdefine ppb pop_backdefine all(x) (x).begin(),(x).end()define fr(i,s,e) for(int i=s;i<e;i++)define read(x) for(auto &i:x) cin>>i;define write(x) for(auto i:x) cout<<i<<" ";define input(n) int n; cin>>n;typedef tree<int,null_type,less,rb_tree_tag,tree_order_statistics_node_update>pbds;//find_by_order,order_of_key signed main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); _test
{
int n,m;
cin>>n>>m;
vector<pair<int,int>>adj[n];
for(int i=0;i<m;i++){
int u,v,w;
cin>>u>>v>>w;
u--;
v--;
adj[u].pb({v,w});
adj[v].pb({u,w});
}
vector<int>s(n);
read(s);
vector<vector<int>>dist(n,vector<int>(n,INT_MAX));
dist[0][0]=0;
priority_queue<pair<int,pair<int,int>>,vector<pair<int,pair<int,int>>>,greater<pair<int,pair<int,int>>>>q;
q.push({0,{0,0}});
while(!q.empty()){
auto pr=q.top();
q.pop();
int curr_dist=pr.ff,curr_node=pr.ss.ff,curr_bike=pr.ss.ss;
if(curr_node==n-1){
cout<<curr_dist<<"\n";
break;
}
for(auto it:adj[curr_node]){
int added_dist=it.ss*s[curr_bike];
if(curr_dist+added_dist<dist[it.ff][curr_bike]){
dist[it.ff][curr_bike]=curr_dist+added_dist;
int bike=curr_bike;
if(s[it.ff]<s[curr_bike]) bike=it.ff;
q.push({curr_dist+added_dist,{it.ff,bike}});
}
}
}
}} ~~~~~ |
| Name |
|---|


