2012年7月11日

HDOJ 4006 The kth great number

摘要: 这道题来自于 The 36th ACM/ICPC Asia Regional Dalian Site —— Online Contest 线段树求第 k 大值,包含修改和询问;----------------------------------------------------------------------------Problem DescriptionXiao Ming and Xiao Bao are playing a simple Numbers game. In a round Xiao Ming can choose to write ... 阅读全文

posted @ 2012-07-11 16:50 getgoing 阅读(358) 评论(0) 推荐(0)

POJ 3264 Balanced Lineup

摘要: 线段树的做法,1438MS;------------------------------------------------------------------DescriptionFor the daily milking, Farmer John's N cows (1 ≤ N ≤ 50,000) always line up in the same order. One day Farmer John decides to organize a game of Ultimate Frisbee with some of the cows. To keep things simpl 阅读全文

posted @ 2012-07-11 15:05 getgoing 阅读(209) 评论(0) 推荐(0)

0711 Can you answer these queries I

摘要: 线段树,修改,维护区间最大最小、和;Description维护一个整数序列,支持以下操作:1 x v : 将第x个整数的值修改为v;2 x y : 查询区间[x,y]之间的最小值;3 x y : 查询区间[x,y]之间的最大值;4 x y : 查询区间[x,y]内的整数和。Input输入文件包含多组测试数据。对于每组测试数据,第一行为一个整数N(1<=N<=10^5),表示,接下来一行有N个整数,再接下来一行有一个整数M(1<=M<=10^5),表示一共有M个操作。数据保证对于查询操作结果均在int的表示范围内。Output对于每个查询均用一行输出查询的结果。Sampl 阅读全文

posted @ 2012-07-11 14:18 getgoing 阅读(283) 评论(0) 推荐(0)

Trie--字典树

摘要: 第九届中山大学校赛预选赛(2006)Problem A 信息泛滥大致题意:给出 n 个不同的字符串,再给出 m 个字符串,问这 m 个字符串中在给出的 n 个串中没有出现的个数。思路:建 Trie ,统计即可。----------------------------------------------------------# include <stdio.h>struct tree{ tree *node[26]; int bj; tree() { bj = 0; for (int i = 0; i < 26; ++i) n... 阅读全文

posted @ 2012-07-11 01:43 getgoing 阅读(166) 评论(0) 推荐(0)

POJ 3630 Trie树 TLE

摘要: 动态 Trie 会超时,DISCUSS 中有人提醒要用静态数组的 Trie,还没学;这个题要注意除了判断当前串是否有和字典中的串相同的前缀外,还要判断当前串是否是字典中串的前缀;-----------------------------------------------------------------DescriptionGiven a list of phone numbers, determine if it is consistent in the sense that no number is the prefix of another. Let's say the ph 阅读全文

posted @ 2012-07-11 01:34 getgoing 阅读(217) 评论(0) 推荐(0)

POJ 2001 Trie

摘要: 给出的单词不会重复出现,可以建立字典树,设一个域为当前结点重复次数(或者是否重复),对每个单词输出到第一个不重复的字母或者这个单词的结尾。-----------------------------------------------------------------------------------------DescriptionA prefix of a string is a substring starting at the beginning of the given string. The prefixes of "carbon" are: "c& 阅读全文

posted @ 2012-07-11 00:45 getgoing 阅读(271) 评论(0) 推荐(0)

导航