摘要:
思路:将每个layer拆成两个点,编号为N+x,和N+N+x。对所有属于layer x的点i,建N+x到i的有向边,在建i到N+N+x的有向边。最后对所有x号layer和x+1建一条N+N+x到N+x+1的有向边和一条N+N+x+1到N+x的有向边。#include#include#include#include#include#include#include#include#include#include#define pb push_back#define mp make_pair#define Maxn 300010#define Maxm 80002#define LL __int64 阅读全文