双向搜索
tomjobs
别慌,慌也没用
展开
-
Sumsets POJ - 2549(折半搜索 哈希表)
Given S, a set of integers, find the largest d such that a + b + c = d where a, b, c, and d are distinct elements of S. Input Several S, each consisting of a line containing an integer 1 <= n <=...原创 2019-10-28 00:20:23 · 301 阅读 · 0 评论 -
Subset POJ - 3977(折半搜索)
Given a list of N integers with absolute values no larger than 1015, find a non empty subset of these numbers which minimizes the absolute value of the sum of its elements. In case there are multiple subsets, choose the one with fewer elements. Input The i原创 2020-07-23 23:52:14 · 195 阅读 · 0 评论 -
4 Values whose Sum is 0 POJ - 2785(双向搜索)
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, d ) ∈ A x B x C x D are such that a + b + c + d = 0 . In the following, we assume that all lists have the same size n . Input原创 2020-07-18 10:36:32 · 209 阅读 · 0 评论 -
I - Indoorienteering Gym - 101482I(双向搜索)
Lukáš really likes orienteering, a sport that requires locating control points in rough terrain. To entertain the NWERC participants Lukáš wants to organize an orienteering race. However, it would...原创 2020-04-19 23:33:18 · 328 阅读 · 0 评论 -
ACWING171. 送礼物 (双向搜索)
达达帮翰翰给女生送礼物,翰翰一共准备了N个礼物,其中第i个礼物的重量是G[i]。 达达的力气很大,他一次可以搬动重量之和不超过W的任意多个物品。 达达希望一次搬掉尽量重的一些物品,请你告诉达达在他的力气范围内一次性能搬动的最大重量是多少。 输入格式 第一行两个整数,分别代表W和N。 以后N行,每行一个正整数表示G[i]。 输出格式 仅一个整数,表示达达在他的力气范围内一次性能搬动的最大重量。 数据...原创 2020-02-02 20:50:08 · 317 阅读 · 0 评论