文章
71
粉丝
142
获赞
5
访问
52.9k
#include<iostream>
#include<cstring>
#include<string>
#include<queue>
#include<vector>
using namespace std;
const int maxn = 504;
vector<int> graph[maxn];
int level[maxn];
vector<int> topu(int n) {
priority_queue<int, vector<int>, greater<int>> q;
for (int i = 1; i <=n;i++) {
if (level[i] == 0) {
q.push(i);
}
}
vector<int> ans;
while (!q.empty()) {
int now = q.top();
q.pop();
ans.push_back(now);
for (int i = 0; i < graph[now].size();i++) {
int nn = graph[now...
登录后发布评论
graph[i].clear();初始化位置不对