题目大意:给你一些线段的起止点,问你最少用多少条线段可以把一段区间覆盖 线段数<=25000 区间<=1000000
1、spfa+离散化+SLF即可,直接上代码
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
const int maxn=1000010,maxm=2000010;
using namespace std;
int st,ed,tot=0;
int f[maxn],now[maxn];
bool b[maxn];
int h[maxm];
int pre[maxm],son[maxm],v[maxm];
inline void cc(int a,int b,int c)
{
pre[++tot]=now[a];
now[a]=tot;
son[tot]=b;
v[tot]=c;
......
阅读全文