Universal Cup Judging System

Universal Cup

実行時間制限: 2.0 s メモリ制限: 1024 MB 満点: 100 ハック可能 ✓
統計

丸い車輪があります。その外周に沿った周長は $k$ メートルです。

あなたは平らな面に長い直線を引き、その上に車輪を置いて、次の動作を $n$ 回行いました:向きを交互に変えながら、直線に沿って車輪を転がす。つまり、$i$ 回目の動作で車輪が前方に転がったならば、$(i + 1)$ 回目の動作では後方に転がり、逆も同様です。$i$ 回目の動作では、車輪はちょうど $a_i$ メートル進みました。

車輪の外周上の任意の点が面に接触した回数の最小値と最大値を求めてください。

入力

$1$ 行目には、テストケースの数を表す整数 $t$ ($1 \le t \le 10^5$) が含まれます。

続いて $t$ 個のテストケースの説明が与えられます。各説明の $1$ 行目には、動作の回数と車輪の周長をそれぞれ表す $2$ つの整数 $n$, $k$ ($1 \le n \le 3 \cdot 10^5$, $1 \le k \le 10^{18}$) が含まれます。

$2$ 行目には、$1, 2, \dots, n$ 回目の動作で車輪が進んだ距離を表す $n$ 個の整数 $a_1, a_2, \dots, a_n$ ($1 \le a_i \le 10^{12}$) が含まれます。

すべてのテストケースにわたる $n$ の総和は $3 \cdot 10^5$ を超えないことが保証されます。

出力

各テストケースについて、車輪の外周上の任意の点が面に接触した回数の最小値と最大値を表す $2$ つの整数を出力してください。

入出力例

入力例 1

2
3 4
4 8 4
2 7
6 5

出力例 1

4 5
0 2

注記

この問題では入出力データが非常に大きくなる可能性があることに注意してください。使用するプログラミング言語で利用可能な高速な入出力手法を用いることを推奨します。

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.