分析
做了几道这样的题,有没有惊奇的发现,题目中一般都会非常明显的告诉你这是一个有向无环图(“And some points are connected by one-way road, which means that, through the road, a robot can only move from one end to the other end, but cannot move back. For some unknown reasons, there is no circle in this graph”)
也会非常友善的告诉你限制:这是一个可重复点覆盖(“You should notice that the roads of two different robots may contain some same point. ”)
那就用Floyd传递闭包,让本会经过重复的点的两条链,变成不会重复的路径,然后拆点,二分图匹配即可
代码
RE代码
#include<cstdio>
#include<iostream>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<cstdlib>
#include<queue>
#define in read()
#define M 2