分治
二分&分治
月球上的人_
永远在怀念
展开
-
ACwing 257 - 关押罪犯(二分答案 + 二分图染色)
S 城现有两座监狱,一共关押着 N 名罪犯,编号分别为1~N。他们之间的关系自然也极不和谐。很多罪犯之间甚至积怨已久,如果客观条件具备则随时可能爆发冲突。我们用“怨气值”(一个正整数值)来表示某两名罪犯之间的仇恨程度,怨气值越大,则这两名罪犯之间的积怨越多。如果两名怨气值为 c 的罪犯被关押在同一监狱,他们俩之间会发生摩擦,并造成影响力为 c 的冲突事件。每年年末,警察局会将本年内监狱中的所有冲突事件按影响力从大到小排成一个列表,然后上报到 S 城 Z 市长那里。公务繁忙的 Z 市长只会去看列表原创 2020-08-24 17:14:10 · 187 阅读 · 0 评论 -
Codeforces 1385D - a-Good String(分治 + 贪心)
D. a-Good Stringtime limit per test 2 secondsmemory limit per test 256 megabytesinput standard inputoutput standard outputYou are given a string s[1…n] consisting of lowercase Latin letters. It is guaranteed that n=2k for some integer k≥0.The string原创 2020-07-18 18:38:05 · 419 阅读 · 5 评论 -
POJ 3258-River Hopscotch(二分答案)
River HopscotchTime Limit: 2000MS Memory Limit: 65536KTotal Submissions: 25633 Accepted: 10556DescriptionEvery year the cows hold an event featuring a peculiar version of hopscotch that involves...原创 2020-02-23 11:03:08 · 216 阅读 · 0 评论 -
CodeForces 1324D - Pair of Topics(二分查找)
The next lecture in a high school requires two topics to be discussed. The i-th topic is interesting by ai units for the teacher and by bi units for the students.The pair of topics i and j (i<j) i...原创 2020-03-20 21:07:55 · 363 阅读 · 0 评论 -
UVA 1152-4 Values whose Sum is 0(二分查找)
The SUM problem can be formulated as follows: given four lists A, B, C, D of integer values, computehow many quadruplet (a, b, c, d) ∈ A × B × C × D are such that a + b + c + d = 0. In the following,...原创 2020-03-20 20:42:50 · 266 阅读 · 0 评论