1586 : 分尺传讯
- 时间限制Time Limit
- 1 秒Sec
- 内存限制Memory Limit
- 256 兆MB
- 提交次数Submitted
- 120 次Times
- 通过次数Solved
- 43 次Times
第二轮比对输出Pass 2 compare
各语言实际时限 Time Limits by Language
| C / C++ | 1 s |
|---|---|
| Java / Python3 / Kotlin |
3 s
1s + 2s
|
全局时限上限:30 s(补偿后超出截断) Global time cap: 30 s (after allowances)
各语言实际内存 Memory Limits by Language
| C / C++ | 256 MB |
|---|---|
| Java / Kotlin |
768 MB
256 + 512 MB · 含 JVM
256 + 512 MB · JVM
|
| Python3 |
768 MB
256 + 512 MB
|
全局内存上限:2048 MB(补偿后超出截断) Global memory cap: 2048 MB (after allowances)
通信评测 Communication
同一程序会被顺序启动两次。每次启动先读本题给出的轮次标记,再按该轮的约定读写。两轮之间不得自行写文件传递数据,中间结果由评测转发。
The same program is started twice in sequence. Each run first reads this problem’s round token, then follows that round’s I/O. Do not pass data between runs via files; the judge forwards the intermediate result.
| 各轮Each run | 独立启动。模板中的 first / second 仅为示例,提交时须改成题面规定的标记。Started independently. first / second in the template are examples; use the tokens from the statement. |
|---|---|
| 输出Output | 每次输出后须 flush。C:fflush(stdout);C++:cout.flush();Java / Kotlin:System.out.flush();Python:print(..., flush=True)。Flush after each write: fflush(stdout) / cout.flush() / System.out.flush() (Java/Kotlin) / print(..., flush=True). |
| 轮次间Between runs | 由评测根据程序输出转发,不得写文件留给下一轮。Forwarded by the judge from the program’s output; do not leave files for the next run. |
| 时间与内存Time and memory | 题目上的时间限制和内存限制对每一轮单独生效。任一轮超出即超时或超内存。记录取两轮里较大的时间和较大的内存,两轮不累加。The problem limits apply to each run on its own. One run over the limit is time or memory limit exceeded. The record keeps the larger time and the larger memory of the two runs. The runs are not added together. |
题目描述Description
原料不能焊接。一根长度为 a_i 的原料,按定尺 L 只能切出 \lfloor a_i/L\rfloor 段。要凑够 k 段,问最少用几根原料;凑不够则输出 -1。
输入格式Input
同一程序跑两轮。交互器写出的第一行是轮次。
第一轮,读入
1
n L
a_1 a_2 ... a_n
输出一行 n 个整数:每根原料的段数,按非增顺序排列。评测会把这一行与真实段数的非增排列逐项比较。
第二轮,读入
2
n k
p_1 p_2 ... p_n
其中 p 是你第一轮交出的序列。输出一行一个整数,即最少原料根数或 -1。
1\le n\le 2\times 10^5,1\le L,k\le 10^{18},0\le a_i\le 10^{18}。
输出格式Output
按协议写出最终答案,并在每次输出后刷新缓冲区。
样例Sample
提示Hint
样例 1 里段数 1,0,2,1,降序为 2,1,1,0。前两根之和是 3,已经不少于 k。样例 2 的总段数是 0,不够 k=1。
出题Author
Grok4.7, DeepSeekV4Flash, CSGrandeur
来源Source
CCPC2026网络热身-第二场
题目到此结束End of problem