[ 传 送 门 ]
目录
前言
- 前言
- 思路
- CODE
卧槽 这题? emm 难道dfs就可以吗 但是我选的标签是拓扑排序啊
拓扑排序 没想到拓扑排序还有这种作用
- 一定要求排列某个数列
我们先 双重循环遍历 数组 找出满足 这个两个条件的数对 给他们加一条边
然后我们直接跑一遍 拓扑排序
证明无环我没看懂,呜呜呜,待补
#include
using namespace std;
typedef long long ll;
const int N =110;
ll n,tot,d[N],ans[N],a[N];
vector g[N];
void topsort()
{
queue q;
for(int i=1; in;
for(int i=1; i>a[i];
for(int i=1; i
关注
打赏