随笔分类 -  技巧—二分

摘要:略略略,都是2000分一下的题。 阅读全文
posted @ 2021-06-29 23:06 天之道,利而不害 阅读(172) 评论(0) 推荐(0) 编辑
摘要:还要撸GNN,泪 阅读全文
posted @ 2020-04-24 12:12 天之道,利而不害 阅读(381) 评论(0) 推荐(0) 编辑
摘要:准备C复试的一部分,有些题比较有趣,限制了时间或空间复杂度后,确实挺难想到的。比如给一个数组,里面有且仅有一个重复的数字,然后限定空间复杂度O(1),求解 阅读全文
posted @ 2020-04-22 21:08 天之道,利而不害 阅读(344) 评论(0) 推荐(0) 编辑
摘要:题意 有一个长为n(1n2105)a序列,输出:出现最多次数的长度为k(1kn)的子序列。 题解 二分枚举子序列的出现次数t,然后检查是否有k个数出现了t次。 代码 ~~~c++ const int N = 200005; 阅读全文
posted @ 2018-11-17 14:32 天之道,利而不害 阅读(188) 评论(0) 推荐(0) 编辑
摘要:题意 一串长度为n,且只包含R,L,U,D这四种字符的字符串。 R(x+1,y) L(x1,y) U(x,y+1) D(x,y1) 已知机器人现在的位置是(0,0),机器人要到的位置是(x0,y0)。所以现在可能需要修改某些位置的字符,在被修改的 阅读全文
posted @ 2018-10-26 21:11 天之道,利而不害 阅读(217) 评论(0) 推荐(0) 编辑
摘要:ps:就一个普通的二分。。。永远都是debug的时间比写代码的时间还长 阅读全文
posted @ 2018-08-14 12:52 天之道,利而不害 阅读(223) 评论(0) 推荐(0) 编辑
摘要:Given an array having N elements, each element is either -1 or 1. You have M queries, each query has two numbers L and R, you have to answer the lengt 阅读全文
posted @ 2018-04-26 15:11 天之道,利而不害 阅读(368) 评论(0) 推荐(0) 编辑
摘要:Problem Description 有一台机器,并且给你这台机器的工作表,工作表上有n个任务,机器在ti时间执行第i个任务,1秒即可完成1个任务。有m个询问,每个询问有一个数字q,表示如果在q时间有一个工作表之外的任务请求,请计算何时这个任务才能被执行。机器总是按照工作表执行,当机器空闲时立即执 阅读全文
posted @ 2018-03-20 12:43 天之道,利而不害 阅读(249) 评论(0) 推荐(0) 编辑
摘要:Well, here is another math class task. In mathematics, GCD is the greatest common divisor, and it's an easy task to calculate the GCD between two posi 阅读全文
posted @ 2017-10-21 23:37 天之道,利而不害 阅读(390) 评论(0) 推荐(0) 编辑
摘要:A game field is a strip of 1 × n square cells. In some cells there are Packmen, in some cells — asterisks, other cells are empty. Packman can move to 阅读全文
posted @ 2017-10-18 22:23 天之道,利而不害 阅读(908) 评论(2) 推荐(0) 编辑
摘要:Farmer John's N (1 <= N <= 50,000) cows (numbered 1..N) are planning to run away and join the circus. Their hoofed feet prevent them from tightrope wa 阅读全文
posted @ 2017-05-10 23:51 天之道,利而不害 阅读(210) 评论(0) 推荐(0) 编辑
摘要:In a certain course, you take n tests. If you get ai out of bi questions correct on test i, your cumulative average is defined to be . Given your test 阅读全文
posted @ 2017-05-10 16:12 天之道,利而不害 阅读(236) 评论(0) 推荐(0) 编辑
摘要:Every year the cows hold an event featuring a peculiar version of hopscotch that involves carefully jumping from rock to rock in a river. The exciteme 阅读全文
posted @ 2017-04-29 00:12 天之道,利而不害 阅读(180) 评论(0) 推荐(0) 编辑
摘要:It is very hard to wash and especially to dry clothes in winter. But Jane is a very smart girl. She is not afraid of this boring process. Jane has dec 阅读全文
posted @ 2017-04-26 17:23 天之道,利而不害 阅读(262) 评论(0) 推荐(0) 编辑
摘要:Given N numbers, X1, X2, ... , XN, let us calculate the difference of every pair of numbers: ∣Xi - Xj∣ (1 ≤ i < j ≤ N). We can get C(N,2) differences 阅读全文
posted @ 2017-04-25 22:49 天之道,利而不害 阅读(198) 评论(0) 推荐(0) 编辑
摘要:Farmer John is an astounding accounting wizard and has realized he might run out of money to run the farm. He has already calculated and recorded the 阅读全文
posted @ 2017-04-23 21:49 天之道,利而不害 阅读(223) 评论(0) 推荐(0) 编辑
摘要:King George has recently decided that he would like to have a new design for the royal graveyard. The graveyard must consist of several sections, each 阅读全文
posted @ 2017-04-23 21:43 天之道,利而不害 阅读(352) 评论(0) 推荐(0) 编辑
摘要:As you very well know, this year's funkiest numbers are so called triangular numbers (that is, integers that are representable as , where k is some po 阅读全文
posted @ 2017-04-23 12:05 天之道,利而不害 阅读(546) 评论(0) 推荐(0) 编辑
摘要:One day a highly important task was commissioned to Vasya — writing a program in a night. The program consists of n lines of code. Vasya is already ex 阅读全文
posted @ 2017-04-23 12:01 天之道,利而不害 阅读(344) 评论(0) 推荐(0) 编辑
摘要:This problem is given in two versions that differ only by constraints. If you can solve this problem in large constraints, then you can just write a s 阅读全文
posted @ 2017-04-22 16:09 天之道,利而不害 阅读(321) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示