Shirlies
宁静专注认真的程序媛~
摘要: 用两个数组存储,再排序就OK了,如果有1 2,没有2 1,那么第二个数组排序后肯定没有1 2,那么就NO了~~~View Code 1 #include <cstdio> 2 #include <cstring> 3 #include <algorithm> 4 5 struct per 6 { 7 int start,end; 8 }; 9 per p[500010],rp[500010];10 11 bool cmp(per p1,per p2)12 {13 if(p1.start == p2.start)14 return p1.end < p2 阅读全文
posted @ 2012-03-15 15:57 Shirlies 阅读(198) 评论(0) 推荐(0) 编辑
摘要: View Code 1 #include <cstdio> 2 #include <cstring> 3 4 const int sonnum = 26; 5 char word[120005][30]; 6 struct trie 7 { 8 bool term; 9 struct trie *son[sonnum];10 };11 12 trie* create_trie()13 {14 trie *temp = new trie;15 temp -> term = false;16 for(int i = 0;i <sonnum;i++)17 ... 阅读全文
posted @ 2012-03-15 15:06 Shirlies 阅读(276) 评论(0) 推荐(0) 编辑