随笔分类 -  二分专题

摘要: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 @ 2020-04-06 23:34 AlexLIN· 阅读(195) 评论(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 @ 2020-04-06 20:01 AlexLIN· 阅读(246) 评论(0) 推荐(0)
摘要:bool check(){ } while(l<=r) { int mid=(l+r)/2;//min=l+(r-l)/2 防止数据溢出 if(check(mid)) l=mid+1; else r=mid-1; } //最大值最小答案是l,最小值最大答案是r 阅读全文
posted @ 2020-04-06 19:56 AlexLIN· 阅读(135) 评论(0) 推荐(0)
摘要:训练赛上一题,当时没做出来,Orz太弱了 The SUM problem can be formulated as follows: given four lists A, B, C, D of integer values, compute how many quadruplet (a, b, c 阅读全文
posted @ 2020-04-06 18:53 AlexLIN· 阅读(181) 评论(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 @ 2020-04-06 17:35 AlexLIN· 阅读(168) 评论(0) 推荐(0)
摘要:每年奶牛们都要举办各种特殊版本的跳房子比赛,包括在河里从一块岩石跳到另一块岩石。这项激动人心的活动在一条长长的笔直河道中进行,在起点和距离起点 L 远的终点各有一块岩石 (1 ≤ L ≤ 10^9)。在起点和终点之间,有 N 块岩石 (0 ≤ N ≤ 50000),每块岩石与起点的距离分别为 Di 阅读全文
posted @ 2020-04-06 15:44 AlexLIN· 阅读(278) 评论(0) 推荐(0)
摘要:Inhabitants of the Wonderland have decided to hold a regional programming contest. The Judging Committee has volunteered and has promised to organize 阅读全文
posted @ 2020-04-06 04:15 AlexLIN· 阅读(196) 评论(0) 推荐(0)