旅行计划 题目传送门 解题思路 这题就是拓扑排序+dp 先拓扑排序找相连的点 再用dp统计答案 拓扑排序 AC代码 #include<iostream> using namespace std; int n,m,x,y,h,t,num,tot,b[100005],c[100005],p[100005],head[200005],f[100005]; struct stu { int to,next; }a[200005]; void add(int x,int y)//邻接表 { tot++; a[tot].to=y; a[tot].next=head[x]; head[x]=...