题目链接:Zuhair and Strings 题目原文 Given a string 𝑠 of length 𝑛 and integer 𝑘 (1≤𝑘≤𝑛). The string 𝑠 has a level 𝑥, if 𝑥 is largest non-negative inte ...
分类:
其他好文 时间:
2019-01-28 01:25:02
阅读次数:
174
题目链接:传送门 思路:建立一个32位的字典树,对每一个要插入的数字查找它异或的最大值(就是尽量全部二进制的值都相反), 然后获得两个数异或的最大值。 #include<iostream> #include<cstdio> #include<cstring> using namespace std; ...
分类:
其他好文 时间:
2019-01-23 22:09:04
阅读次数:
316
#Given a set of distinct positive integers, find the largest subset such that every pair (Si, Sj) of elements in this subset satisfies:#Si % Sj = 0 or ...
分类:
其他好文 时间:
2019-01-22 00:34:37
阅读次数:
192
You are given a number of case-sensitive strings of alphabetic characters, find the largest string X, such that either X, or its inverse can be found ...
分类:
其他好文 时间:
2019-01-21 17:51:19
阅读次数:
197
https://leetcode.com/problems/kth-largest-element-in-a-stream/ 这个题目的意思解读了半天,没搞明白什么意思,后来画了一下图,一下子就明了 1.熟悉了一下怎么使用heapqd的常规函数 2.最后这个 ...
分类:
其他好文 时间:
2019-01-20 23:32:26
阅读次数:
212
题目 "HDU 1506 Largest Rectangle in a Histogram" 做法 以$a_i$为最高高度,以$i$向左右扩展 找到$i$左边比$a_i$小的最右边的位置 找到$i$有边比$a_i$小的最左边的位置 简直是单调栈的模板题 My complete code cpp in ...
分类:
其他好文 时间:
2019-01-17 12:52:46
阅读次数:
218
题目链接 题意:从有向图G中找到一个最大的点集,使得该点集中任意两个结点u,v满足u可达v或v可达u。 解法:先把同处于一个强连通分量中的结点合并(缩点),得到一张DAG图,在DAG上dp即可。 感觉自己的建图写得好丑啊,一直在纠结用数组还是结构体~~ ...
分类:
其他好文 时间:
2019-01-17 12:50:09
阅读次数:
167
703 非常经典的一个题,假设有一个不断增加的序列,要求输出第K 大的数 215 太简单了,就不说了。 ...
分类:
其他好文 时间:
2019-01-15 10:45:42
阅读次数:
231
分析 好久不刷题真的思维僵化,要考虑到这样一个结论:如果递增的三个数$x_i,x_{i+1},x_{i+2}$不符合题意,那么最大的两边之差一定大于等于第一条边,那么任何比第一条边小的都不能成立。这样一来,递增排序,然后线性找就可以了。 代码 ...
分类:
编程语言 时间:
2019-01-14 01:06:11
阅读次数:
255
Problem: Given an array which consists of non-negative integers and an integer m, you can split the array into m non-empty continuous subarrays. Write ...
分类:
其他好文 时间:
2018-12-31 10:27:04
阅读次数:
403