QOJ.ac

QOJ

Time Limit: 2 s Memory Limit: 256 MB Total points: 100

#22734. Cân

Statistics

Farmer John có cân bò và $N$ ($1 \le N \le 1000$) quả cân biết khối lượng (31 bit) một bên. Bò một bên, quả bên kia tới cân bằng. Không cùng bò vì nó đá vào mặt ông khi có thể. Tổng một bên hơn $C$ ($1 \le C < 2^{30}$) làm vỡ.

Nhỏ tới lớn, từ quả thứ ba mỗi ít nhất tổng hai trước.

Muốn lớn nhất chính xác, tổng không quá $C$, có thể không đặt hết.

Cho danh sách và sức chịu, tìm lớn nhất hợp lệ cân chính xác.

Dữ liệu vào

Dòng 1: nguyên dương $N$, $C$ cách dấu cách.

Dòng $2..N+1$: mỗi nguyên dương khối lượng, không giảm bảo đảm.

Dữ liệu ra

Dòng 1: nguyên, lớn nhất chính xác an toàn.

Ví dụ

Dữ liệu vào 1

3 15
1
10
20

Dữ liệu ra 1

11

Ghi chú

Ba quả 1,10,20, một bên tối đa15.

1 và10 cân11. Mọi lớn hơn tạo được làm vỡ.

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.