Universal Cup Judging System

Universal Cup

Limite de temps : 4.0 s Limite de mémoire : 1024 MB Points totaux : 100 Hackable ✓
Statistiques

平方王国では、$1$ から $n$ までの番号が付けられた $n$ 人の住民が、それぞれ高い石柱の頂上に一人で暮らしています。$i$ 番目の住民の石柱の地面からの高さは $\left(i + \frac{b}{a}\right)^2$ 単位です。

全員がとても高い場所に住んでいるため、隣人を訪ねる唯一の方法ははしごを使うことです。王国は住民のすべてのペアに対して 1 本ずつはしごを建設します。各はしごの長さは、それが結ぶ 2 本の石柱の高さの差の絶対値に等しくなります。

はしごは全部で $\frac{n(n-1)}{2}$ 本あるため、すべてを管理するのは大変です。はしごを長さの昇順に並べたときの $k$ 番目のはしごの長さを求めてください。この情報は、王国が修理、配達、および地域のイベントを計画するのに役立ちます。

入力

唯一の行に 4 つの整数 $n$($2 \le n \le 10^{12}$)、$k$($1 \le k \le \min\left\{\frac{n(n-1)}{2}, 10^{12}\right\}$)、$a$($1 \le a \le 10^6$)、および $b$($0 \le b \le 10^{12}$)が与えられます。

出力

2 つの整数 $p$ と $q$ を含む 1 行を出力してください。これは、長さの昇順で $k$ 番目のはしごの長さが 2 つの整数 $p$ と $q$($p \ge 0$、$q \ge 1$、$\gcd(p, q) = 1$)を用いて $\frac{p}{q}$ と表せることを意味します。ここで $\gcd(p, q)$ は $p$ と $q$ の最大公約数です。

入出力例

入力例 1

3 1 3 1

出力例 1

11 3

入力例 2

3 2 3 1

出力例 2

17 3

入力例 3

3 3 3 1

出力例 3

28 3

入力例 4

1414215 1000000000000 1000000 1000000000000

出力例 4

4823373069559 1

Editorials

IDTypeStatusTitlePosted ByLast UpdatedActions
#2666EditorialOpen$O(\sqrt{k})$ by GPT6 ProAnonymousView

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.