上一页 1 ··· 5 6 7 8 9 10 11 12 13 ··· 22 下一页
摘要: Sagheer is working at a kindergarten. There are n children and m different toys. These children use well-defined protocols for playing with the toys: 阅读全文
posted @ 2017-06-02 17:07 perplex 阅读(484) 评论(2) 推荐(0) 编辑
摘要: Sagheer is playing a game with his best friend Soliman. He brought a tree with n nodes numbered from 1 to n and rooted at node 1. The i-th node has ai 阅读全文
posted @ 2017-06-02 09:51 perplex 阅读(208) 评论(0) 推荐(0) 编辑
摘要: In his spare time Vladik estimates beauty of the flags. Every flag could be represented as the matrix n × m which consists of positive integers. Let's 阅读全文
posted @ 2017-05-29 22:35 perplex 阅读(317) 评论(0) 推荐(0) 编辑
摘要: Vladik often travels by trains. He remembered some of his trips especially well and I would like to tell you about one of these trips: Vladik is at in 阅读全文
posted @ 2017-05-29 15:41 perplex 阅读(130) 评论(0) 推荐(0) 编辑
摘要: Given a positive integer n, find the number of non-negative integers less than or equal to n, whose binary representations do NOT contain consecutive 阅读全文
posted @ 2017-05-29 11:15 perplex 阅读(137) 评论(0) 推荐(0) 编辑
摘要: Given a sequence, {A1, A2, ..., An} which is guaranteed A1 > A2, ..., An, you are to cut it into three sub-sequences and reverse them separately to fo 阅读全文
posted @ 2017-05-26 21:00 perplex 阅读(205) 评论(0) 推荐(0) 编辑
摘要: The kingdom of Olympia consists of N cities and M bidirectional roads. Each road connects exactly two cities and two cities can be connected with more 阅读全文
posted @ 2017-05-25 23:51 perplex 阅读(393) 评论(0) 推荐(0) 编辑
摘要: You're given a matrix A of size n × n. Let's call the matrix with nonnegative elements magic if it is symmetric (so aij = aji), aii = 0 and aij ≤ max( 阅读全文
posted @ 2017-05-25 23:46 perplex 阅读(252) 评论(0) 推荐(0) 编辑
摘要: 题目地址 每组数据,对模式串建立Trie树,为避免模式串重复的情况,用mao建立模式串与编号的对应关系。 对匹配串AC自动机处理,其中print改为更新出现次数。 最后找一下次数最大的输出即可。 阅读全文
posted @ 2017-05-24 14:08 perplex 阅读(175) 评论(0) 推荐(0) 编辑
摘要: 题目链接 分别对名字和绰号建立2个trie树,其中记录树每个结点经过过多少次。 每个字符串在trie树中的路径都是固定的,故可以同时遍历两个树(某树不存在某个结点就停止这一侧的遍历),不妨设某一结点 名字树有x次经历,绰号树有y次经历。(不妨设x<=y),则任取y个绰号中的x个与这x个名字任意匹配, 阅读全文
posted @ 2017-05-24 11:03 perplex 阅读(231) 评论(0) 推荐(0) 编辑
上一页 1 ··· 5 6 7 8 9 10 11 12 13 ··· 22 下一页