无事闲来水一水Tarjan,结果水挂了。。。。。。
先Tarjan缩点。
第一问是DAG上的最长路径(点权)
第二问是最长路径的方案数。
都是DP。
然而第二问坑了。。。。。。
因为没判重边(很明显重新建图的时候会出现重边啊)
毕竟还是弱啊。
#include<iostream>
#include<cstdio>
#include<cstring>
#include<stack>
using namespace std;
const int N=100000+5;
const int M=1000000+5;
typedef long long ll;
inline int read(){
int x=0;char ch;
while(ch<'0'||ch>'9')ch=getchar();
while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}