Max (Sum - Max)
You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.
[ABC348G] Max (Sum - Max)
题目描述
给定两个长为 的序列 和 ,令 是一个下标集合,且记 。
现在对每个 ,求$\displaystyle\ (\sum_{i\ \in\ S}\ A_i)\ -\ \max_{i\ \in\ S}\ B_i$ 的最大值。
输入格式
第一行一个整数 ,接下来 行每行两个整数 。
输出格式
行,第 行表示 时的答案。
输入输出样例 #1
输入 #1
3
4 1
5 6
3 2
输出 #1
3
5
6
输入输出样例 #2
输入 #2
2
0 1
0 1
输出 #2
-1
-1
输入输出样例 #3
输入 #3
6
9 7
2 4
7 1
-1000 0
3 4
8 5
输出 #3
6
10
17
20
22
-978
说明/提示
数据范围
- $-2\ \times\ 10^{14}\ \leq\ B_i\ \leq\ 2\ \times\ 10^{14}$
样例解释 1
以下是对每个 选定 的方案。
- :
- :
- :
20250311集训
- Status
- Done
- Rule
- IOI
- Problem
- 7
- Start at
- 2025-3-11 19:30
- End at
- 2025-3-11 21:30
- Duration
- 2 hour(s)
- Host
- Partic.
- 9