poj2449第k短路模板

这篇博客主要探讨了POJ2449问题的解决方案,特别是关于第k短路的模板。作者指出,在实现过程中,当源点s等于目标点t时,k值需要增加,但发现知名解题平台红书对此关键细节没有明确说明,对此表达了疑惑。
摘要由CSDN通过智能技术生成

 

链接、

红书模板

明明s == t的时候k要++,为什么红书一点都没提啊啊啊啊啊啊啊啊啊啊啊啊啊啊、

#include<cstdio>
#include<queue>
#include<string.h>
#include<utility>
using namespace std;
typedef long long ll;
//#define getchar()(p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 1 << 21, stdin), p1 == p2) ? EOF : *p1++)
//char buf[(1 << 21) + 1], *p1 = buf, *p2 = buf;
const int maxn = 1e4+7,maxm = 1e6+7;
int n,m,cnt;
int head[2][maxn],to[2][maxm],nex[2][maxm],val[2][maxm],dist[maxn];
bool vis[maxn];
void add(int u,int v,int w){
    to[0][cnt] = v;
    to[1][cnt] = u;
    val[0][cnt] = val[1][cnt] = w;
    nex[0][cnt] = head[0][u];
    nex[1][cnt] = head[1][v];
    head[0][u] = head[1][v] = cnt++;
}
priority_queue<pair&
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值