偏序+拓扑序+字典树
题目描述 给定n个字符串,互不相等,你可以任意指定字符之间的大小关系(即重定义字典序),求有多少个串可能成为字典序最小的串,并输出它们 输入描述: 第一行一个数表示n之后n行每行一个字符串表示给定的字符串 输出描述: 第一行输出一个数x表示可行的字符串个数之后输出x行,每行输出一个可行的字符串输出的顺序和输入的顺序一致 示例1 输入 6 mcfx ak ioi wen l a 输出 5 mcfx ioi wen l a #include <bits/stdc++.h> #define INF 0x3f3f3f3f using namespace std; typedef struct node{ string s;int biao; friend bool operator <(node aa,node bb){ return aa.s.length()<bb.s.length(); } }node; string str[30005]; node dd[30005]; int cnt,root; typedef struct nop{ int a[26],ans; }nop; nop d[300005]; bool vvis[30005]; int newnode(){ cnt++;d[cnt].ans=0; for(int i=0;i<26;i++) d[cnt].a[i]=0