問題一覧 > ネタ問題

No.8090 Knapsack Function

レベル : / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 127
作問者 : SSRS / テスター : sak
お気に入りにしたユーザー ProblemId : 7044 / 自分の提出
問題文最終更新日: 2022-03-22 22:08:40
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. Back to the original
yukicoder April Fool Contest 2022 (順位表) の他の問題:

Problem Statement

There are $N$ items. The $i \ (1 \leq i \leq N)$-th item has value $v_i$ and weight $w_i$.
For a non-negative integer $W$, define $f(W)$ as follows.

  • When choosing some items so that their total weight is equal to $W$, let $f(W)$ be the maximum possible total value of the chosen items. Here, the same item may be chosen multiple times. If it is impossible to choose items so that their total weight is equal to $W$, let $f(W)=-1$.
Determine whether $f$ is monotonically increasing, that is, whether $f(n) < f(n+1)$ holds for every non-negative integer $n$.

Input

$N$
$v_1 \ w_1$
$v_2 \ w_2$
$\vdots$
$v_N \ w_N$

The input satisfies the following constraints.

  • All input values are integers.
  • $1 \leq N \leq 10^5$
  • $1 \leq v_i \leq 10^9 \ (1 \leq i \leq N)$
  • $1 \leq w_i \leq 10^9 \ (1 \leq i \leq N)$

Output

Print Yes if $f$ is monotonically increasing, and No otherwise.

Sample

There are no samples.

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