C - String Reconstruction 我只服这个题原字符串的范围,刚开始没注意一直wa,以为代码写错,后来网上找了份代码对拍,发现数据范围写小了,ki最大取到1e6,加上字符串最大1e6,所以范围是2e6。 #include <bits/stdc++.h> using namespac ...
分类:
其他好文 时间:
2017-07-14 11:54:17
阅读次数:
112
Codeforces Round #423 (Div. 2, rated, based on VK Cup Finals) 从给出信息片段,得出字典序最小的一个字符串,题目保证答案存在 信息给出形式: 3 a 4 1 3 5 7ab 2 1 5ca 1 4第一行 3 代表信息片段个数第二行 a 代表 ...
分类:
其他好文 时间:
2017-07-13 14:21:47
阅读次数:
154
题意:给出各个字符串出现的起始位置,问整个的字符串是什么,(字典序最小) 思路:开始写的是用set+优先队列存取每个位置出现的最长字符串,然后遍历,爆内存。。。爆。。。内。。。存。。。我们可以用并查集,已经确认的位置他们并在一起,指向后面第一个没有被确认的(看代码理解吧) ...
分类:
其他好文 时间:
2017-07-13 01:05:30
阅读次数:
204
Codeforces Round #423 (Div. 2, rated, based on VK Cup Finals) C. String Reconstruction 思维,并查集 或 线段树 题意:一个字符串被删除了,但给出 n条信息,要还原出可能的字典序最小的字符串。信息有:字符串ti,k ...
分类:
其他好文 时间:
2017-07-12 23:08:15
阅读次数:
193
题目大意:告诉你n个字符串以及这些字符串在字符串s中出现的位置(x1,x2.....xn),要求在满足上述条件的情况下,求出字典序最小的字符串s。 解题思路:主要问题是,如果直接模拟是会超时的,比如vvvvvvvvvv 3 1 2 3这样就有大量重复(因为题目说了这些字符串位置不会相互矛盾,所以已经 ...
分类:
其他好文 时间:
2017-07-12 17:39:33
阅读次数:
123
C - String Reconstruction 方法一:把确定的点的父亲节点设为下一个点,这样访问过的点的根节点都是没访问过的点。 代码: 方法二:把所有点放进set容器里,拜访过的点就删掉。 代码: ...
分类:
其他好文 时间:
2017-07-12 16:50:15
阅读次数:
104
refer to: https://discuss.leetcode.com/topic/60394/easy-concept-with-python-c-java-solution E.g.input: [[7,0], [4,4], [7,1], [5,0], [6,1], [5,2]]subar ...
分类:
其他好文 时间:
2017-07-11 01:05:42
阅读次数:
175
Suppose you have a random list of people standing in a queue. Each person is described by a pair of integers (h, k), where h is the height of the pers ...
分类:
其他好文 时间:
2017-05-24 00:50:08
阅读次数:
233
https://leetcode.com/problems/queue-reconstruction-by-height/#/description ...
分类:
其他好文 时间:
2017-05-01 22:27:59
阅读次数:
186
Suppose you have a random list of people standing in a queue. Each person is described by a pair of integers (h, k), where h is the height of the pers ...
分类:
其他好文 时间:
2017-02-16 01:24:03
阅读次数:
225