【题解】洛谷P3953[NOIP2017]逛公园 最短路+拓扑排序+计数类DP

题目链接学习了大佬题解。根据大佬的讲解,把对应部分分的代码打到一起了。(有点臃肿)#pragma GCC optimize(2)#include<cstdio>#include<cstring>#include<algorithm>#include<queue>using namespace std;typedef long ...
摘要由CSDN通过智能技术生成

题目链接
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述


学习了大佬题解。根据大佬的讲解,把对应部分分的代码打到一起了。(有点臃肿)

#pragma GCC optimize(2)
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<queue>
using namespace std;
typedef long long ll;
const int N=1e5+10,M=2e5+10;
#define re register
int tot,t,n,m,k,p,hd[N],vis[N],hdn[N],totn,id[N],idx[N];
int cnt[N],f[N][55],ans,deg[N],hd0[N],tot0,q[N];
ll dis[N],disn[N];
inline int read()
{
	int s=0,f=1;char ch=getchar();
	while(ch>'9'||ch<'0'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9')s=(s<<1)+(s<<3)+(ch^48),ch=getchar();
	return s*f;
}
struct Edge{
	int v,nx;ll w;
}e[M],en[M];
struct node{
	int u;ll w;
	node(){}
	node(int _u,ll _w):u(_u),w(_w){}
	bool operator <(const node&rhs)const{
	return w>rhs.w;}
};
namespace pts30{
	void add(int u,int v,ll w)
    {
	    e[tot].v=v;
	    e[tot].nx=hd[u];
	    e[tot].w=w;
	    hd[u]=tot++;
    }
	void dijkstra()
	{
		memset(dis,0x7f,size
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值