[BZOJ3012][Usaco2012 Dec]First! Description Bessie has been playing with strings again. She found that by changing the order of the alphabet she could make some strings come before all the others lexicographically (dictionary ordering). For instance…
题目描述 Bessie has been playing with strings again. She found that by changing the order of the alphabet she could make some strings come before all the others lexicographically (dictionary ordering). For instance Bessie found that for the strings "omm&…
也就是给定有向图,求最小字典序的拓扑序,直接用小根堆就行(或者反着建图用大根堆) #include<iostream> #include<cstdio> #include<cstring> #include<queue> using namespace std; const int N=100005; int T,n,m,d[N],h[N],cnt,ans[N]; priority_queue<int>q; struct qwe { int ne…