用户输出
440
系统信息
Exited with return code 0
编号 | 题目 | 状态 | 分数 | 总时间 | 内存 | 代码 / 答案文件 | 提交者 | 提交时间 |
---|---|---|---|---|---|---|---|---|
#80622 | #1077. 1-11B. JM的招摇撞骗 | Wrong Answer | 0 | 23 ms | 360 K | C++ 17 / 839 B | 15291309895 | 2022-07-18 18:29:40 |
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ll;
const int MAXN = 2e5 + 7;
struct water {
int a, b;
} Water[MAXN];
bool compare(water x, water y) { return x.b > y.b; }
ll V, n, sum = 0, ans = 0, J;
int main() {
cin >> V >> n;
for (int i = 0; i < n; i++) cin >> Water[i].a >> Water[i].b;
sort(Water, Water + n, compare);
int cnt = 0;
for (int i = 0; i < n; i++) {
if (sum + Water[i].a < V) {
sum += Water[i].a;
ans += Water[i].a * Water[i].b;
cnt++;
}
if (sum == V || cnt == n) {
cout << ans;
return 0;
} else if (sum + Water[cnt].a > V) {
ans += 1.0 * (V - sum) * Water[cnt].b;
cout << ans;
return 0;
}
}
}
用户输出
19855
系统信息
Exited with return code 0
用户输出
3137868819
系统信息
Exited with return code 0
54384 185
16682 13
6704 94
47468 31
41638 49
45976 78
50246 98
46821 8
29575 37
32872 59
4
<1703 bytes omitted>
用户输出
5397784
系统信息
Exited with return code 0
48528 220
22435 100
46510 4
38481 76
6885 33
23060 98
203 80
31345 32
3960 45
1993 91
126
<2035 bytes omitted>
用户输出
4852800
系统信息
Exited with return code 0
564806533 32
264919714 249
185025950 644
314145385 923
81359116 817
211013913 150
412944644 59
<384 bytes omitted>
用户输出
0
Special Judge 信息
Files user_out and answer differ
系统信息
Exited with return code 0