Universal Cup Judging System

Universal Cup

时间限制: 2.0 s 内存限制: 1024 MB 总分: 100 可 Hack ✓
统计

你有一個圓形的輪子。它沿著外圓周的周長為 $k$ 公尺。

你在平坦的表面上畫了一條很長的直線,並將輪子放在上面,然後執行了以下動作 $n$ 次:沿著直線滾動輪子,並交替改變方向。也就是說,如果在第 $i$ 次動作中輪子向前滾動,那麼在第 $(i + 1)$ 次動作中它就會向後滾動,反之亦然。在第 $i$ 次動作中,輪子恰好行進了 $a_i$ 公尺。

現在你想知道輪子外圓周上的任意一點接觸表面的最少次數與最多次數。

輸入格式

第一行包含一個整數 $t$($1 \le t \le 10^5$),表示測試資料的組數。

接下來是 $t$ 組測試資料的描述。每組描述的第一行包含兩個整數 $n$ 和 $k$($1 \le n \le 3 \cdot 10^5$,$1 \le k \le 10^{18}$),分別表示動作次數與輪子的周長。

第二行包含 $n$ 個整數 $a_1, a_2, \dots, a_n$($1 \le a_i \le 10^{12}$),表示輪子在第 $1, 2, \dots, n$ 次動作中行進的距離。

保證所有測試資料中 $n$ 的總和不超過 $3 \cdot 10^5$。

輸出格式

對於每組測試資料,輸出兩個整數:輪子外圓周上的任意一點接觸表面的最少次數與最多次數。

範例

輸入格式 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.