QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#693215 | #9529. Farm Management | xiey# | WA | 0ms | 3544kb | C++23 | 799b | 2024-10-31 15:43:09 | 2024-10-31 15:43:27 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
void solve()
{
ll n, m;
cin >> n >> m;
vector<pair<ll, pair<ll, ll>>> a(n);
for (int i = 0; i < n; i++)
cin >> a[i].first >> a[i].second.first >> a[i].second.second;
sort(a.begin(), a.end());
ll ans = 0;
while (m)
{
auto p = a.back();
if (m < p.second.second)
{
ans += m * p.first;
m = 0;
}
else
{
ans += p.second.second * p.first;
m -= p.second.second;
}
a.pop_back();
}
cout << ans;
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
int t = 1;
// cin>>t;
while (t--)
solve();
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3544kb
input:
5 17 2 3 4 6 1 5 8 2 4 4 3 3 7 5 5
output:
109
result:
ok single line: '109'
Test #2:
score: -100
Wrong Answer
time: 0ms
memory: 3544kb
input:
12 62 503792 9 10 607358 1 3 600501 10 10 33249 4 4 774438 6 6 197692 3 6 495807 8 8 790225 5 9 77272 3 8 494819 4 9 894779 3 9 306279 5 6
output:
40106857
result:
wrong answer 1st lines differ - expected: '35204500', found: '40106857'