2889:Unique Solution

题目描述

Given N (1 N ≤ 1,000) integers a1, a2, …, aN (|ai| ≤ 100,000, 1 ≤ iN) and an integer M (1 ≤ MN), you are to determine whether there exists a unique set of 2M integers s1, e1, s2, e2, …, sM, eM (1 ≤ s1e1 < s2e2 < ... < sMeM N) such that the following sum is maximized:

__poj_jax_start__\sum_{i=1}^M\sum_{j=s_i}^{e_i}a_j__poj_jax_end__

输入解释

The input contains multiple test cases. Each test case contains consists of two lines. The first line gives the integers N and M. The second line gives the integers a1, a2, , aN.

A pair of zeroes indicates the end of the input and should not be processed.

输出解释

Output exactly one line for each test case. Output Yes if the answer is in the affirmative otherwise No.

输入样例
5 2
3 -2 3 -2 4
5 2
3 -2 3 -12 4
0 0
输出样例
No
Yes

该题目是Virtual Judge题目,来自 北京大学POJ

源链接: POJ-2889

最后修改于 2020-10-29 06:46:47 UTC 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
1000 131072

·

·

·

·

登陆或注册以提交代码