
思维题
文章平均质量分 61
henuzxy
已经成为刷题过千的男人,即将成为cf 1900分的男人。
展开
-
leetcode 41. First Missing Positive(思维)
First Missing PositiveHard2902741Add to ListShareGiven an unsorted integer array, find the smallest missing positive integer.Example 1:Input: [1,2,0]Output: 3Example 2:Input: [3,4,-1,1]Out...原创 2020-04-17 00:53:10 · 194 阅读 · 0 评论 -
HDU 5701 中位数计数(思维,区间)好题
Problem Description 中位数定义为所有值从小到大排序后排在正中间的那个数,如果值有偶数个,通常取最中间的两个数值的平均数作为中位数。现在有n个数,每个数都是独一无二的,求出每个数在多少个包含其的区间中是中位数。Input 多组测试数据第一行一个数n(n≤8000)第二行n个数,0≤每个数≤109,Output N个数,依次表示第i个数在多少包含其的区间中是中位数。Sample原创 2017-11-10 14:52:17 · 934 阅读 · 0 评论 -
NYOJ 2355: 点兵点将 (脑洞题)
题目链接题目描述众所不知,LLM是一个红警3的高手,由于要出题所以好几天没有玩结果连简单的电脑都打不过了,因此LLM就可耻的开了外挂虐电脑,外挂的效果是这样的: 当LLM消灭一个属性为ai的单位时,他就能免费制造一个属性为bi的单位,如果他犹豫了一下(甚至可能手速慢了一点)就会错失良机,不能再免费制造它 为了简化这个问题,我们假设如果一个A属性和一个B属性的去同时打一个C属性的单位(A原创 2017-09-18 23:26:33 · 705 阅读 · 0 评论 -
codeforces 918 C. The Monster(思维)
C. The Monster time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output As Will is stuck in the Upside Down, he can still communicate with his mom,...原创 2018-02-01 13:31:17 · 564 阅读 · 0 评论 -
Wannafly挑战赛19 A 队列Q (思路题,更新单点位置对其他数没有影响)
链接:https://www.nowcoder.com/acm/contest/131/A 来源:牛客网时间限制:C/C++ 1秒,其他语言2秒 空间限制:C/C++ 262144K,其他语言524288K 64bit IO Format: %lld 题目描述 ZZT 创造了一个队列 Q。这个队列包含了 N 个元素,队列中的第 i 个元素用 Qi 表示。Q1 表示队头元素,QN 表...原创 2018-07-08 22:36:06 · 219 阅读 · 0 评论 -
牛客网暑期ACM多校训练营(第七场)E Counting 4-Cliques (思维)
https://www.nowcoder.com/acm/contest/145/C链接:https://www.nowcoder.com/acm/contest/145/E 来源:牛客网You love doing graph theory problems. You’ve recently stumbled upon a classical problem : Count the n...原创 2018-08-21 17:43:39 · 297 阅读 · 0 评论 -
codeforces 1157 D. N Problems During K Days (二分+构造)
D. N Problems During K Daystime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputPolycarp has to solve exactly n problems to improve his programming...原创 2019-04-27 15:41:30 · 389 阅读 · 0 评论 -
leetcode 442. 数组中重复的数据 (思维) &448
给定一个整数数组 a,其中1 ≤ a[i] ≤ n (n为数组长度), 其中有些元素出现两次而其他元素出现一次。找到所有出现两次的元素。你可以不用到任何额外空间并在O(n)时间复杂度内解决这个问题吗?示例:输入:[4,3,2,7,8,2,3,1]输出:[2,3]最开始毫无思路,结果发现每个数的范围都是[1,n],所以可以考虑这种做法,如果某个位置的数不属于这个位置,就把他交换到对应...原创 2019-05-14 09:16:51 · 153 阅读 · 0 评论