問題一覧 > 通常問題

No.3014 岩井満足性問題

レベル : / 実行時間制限 : 1ケース 3.000秒 / メモリ制限 : 256 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 165
作問者 : Yama.can / テスター : ゆにたりー卿 👑 binap DeltaStruct Apollo@Kuro Rice_tawara459 のらら あじゃじゃ eom2357
お気に入りにしたユーザー ProblemId : 11743 / 自分の提出
問題文最終更新日: 2025-01-25 11:44:41
Iwai Satisfiability Problem
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Show the original
第1回 岩井星人アンソロジープログラミングコンテスト (順位表) の他の問題:

Problem Statement

Iwai Seijin wants to be satisfied by the next programming contest, "ABC10000". Your job as the contest organizer is to adopt good problems from among the problem proposals while at the same time satisfying Iwai Seijin.

There are $N$ problem proposals, numbered $1, 2, ..., N$.
When problem proposal $i$ is adopted, Iwai Seijin gains $A_i$ of satisfaction. ($A_i$ may be negative.)
Also, problem proposal $i$ has a beauty of $C_i$.

Output the maximum satisfaction Iwai Seijin can gain when $D$ distinct problem proposals are adopted so that the total beauty is at least $K$.
However, if the total beauty cannot be at least $K$, output No.

Constraints

  • $1\leq D\leq N\leq 500$
  • $1\leq K\leq 500$
  • $-10^9\leq A_i\leq 10^9$
  • $0\leq C_i\leq 10^9$
  • All input values are integers.

Input

The input is given from standard input in the following format.

$N\quad D\quad K$
$A_1\quad A_2\quad ... \quad A_{N-1} \quad A_N$
$C_1\quad C_2\quad ... \quad C_{N-1} \quad C_N$

Output

Output the maximum satisfaction that meets the conditions.
If it is impossible to meet the conditions, output No.

Sample

Sample 1
Input
5 3 20
20 10 -15 30 20
3 8 11 9 6
Output
60

When problem proposal $1$, problem proposal $2$, and problem proposal $4$ are adopted, the satisfaction is $60$ and the total beauty is $20$.

Sample 2
Input
1 1 500
3
10
Output
No

No contest that meets the conditions can be made.

Sample 3
Input
16 8 240
101 -202 300 400 -430 700 -720 820 -830 -890 910 -970 990 1013 -1250 1270
50 20 15 35 25 30 35 40 20 30 10 35 0 20 35 20
Output
4494

This can be achieved by adopting problem proposals $1,\ 4,\ 6,\ 7,\ 8,\ 11,\ 14,\ 16$.

提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。