問題一覧 > 通常問題

No.1132 Convex and Concave

レベル : / AI推定難易度 : 120 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 119
作問者 : null / テスター : leafirby
お気に入りにしたユーザー ProblemId : 4826 / 自分の提出
問題文最終更新日: 2022-04-25 23:37:33
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

Problem Statement

null-kun loves high places and low places.
null-kun is about to climb the mountain $f(x)=ax^3+bx^2+cx+d$ on the coordinate plane from $p$ to $q$.
To take commemorative photos at the highest and lowest points in the range $p \le x \le q$, he wants to know their locations ($x$-coordinates) and heights ($y$-coordinates) in advance. Since he prefers nice round spots, he examines only the points where $x$ is an integer.
Please find them on behalf of null-kun.
Since being closer to the start of the climb is better, if there are multiple points attaining the maximum/minimum, output the one closer to $p$.

Constraints

  • $-1000 \le a,b,c,d \le 1000$
  • $-100 \le p \le q \le 100$
  • All inputs are integers

Input

$a\ b\ c\ d\ p\ q$

Output

Let $M$ be the maximum value and $m$ the minimum value in the range $p \le x \le q$, and let $X_M$ be the $x$-coordinate of the maximum value and $X_m$ the $x$-coordinate of the minimum value.
These must be values that can be expressed as $f(X_M)=f(t), f(X_m)=f(s)$ for some integers $t, s$($p \le t, s \le q$).
If there are multiple candidates for $X_M,X_m$, take the one closer to $p$.
Output them separated by spaces, followed by a newline at the end, as shown below.
$M\ X_M\ m\ X_m$

Sample

Sample 1
Input
1 3 3 0 -10 10
Output
1330 10 -730 -10

Sample 2
Input
0 0 1 1000 -10 0
Output
1000 0 990 -10

Note that the coefficients may be $0$.

Source

Beginners After Typhoon Contest#01: F - 凸凹
writer: null
tester: leafirby, QCFium
Ported in accordance with HackerRank's terms of service. Some parts have been modified.

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