题目大意: 给你n个数字, 定义不连贯值为, max(abs(a[ i ] - b[ i ])) ,现在让你把m个新的数字插入n + 1 个空位中,使得不连贯值最小. 思路:二分不连贯值, 每次进行二分图匹配, 注意进行二分图匹配的时候需要加入虚拟的点,因为这n + 1个空位中有些点是必须加数字的. #include<bits/stdc++.h> #define LL long long #define fi first #define se second #define mk make_pa…
Description Handoku is sailing on a lake at the North Pole. The lake can be considered as a two-dimensional square plane containing N × N blocks, which is shown in the form of string containing '*' and '#' on the map. : a normal block; : a block cont…
Description There is a robot, its task is to bury treasures in order on a N × M grids map, and each treasure can be represented by its weight, which is an integer. The robot begins to bury the treasures from the top-left grid. Because it is stupid, i…
Description There are n lotus leaves floating like a ring on the lake, which are numbered 0, 1, ..., n-1 respectively. The leaf 0 and n-1 are adjacent. The frog king wants to play a jumping game. He stands at the leaf 0 initially. For each move, he j…
Description Given a string S, which consists of lowercase characters, you need to find the longest palindromic sub-string. A sub-string of a string S is another string S' that occurs "in" S. For example, "abst" is a sub-string of "…