QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#693215#9529. Farm Managementxiey#WA 0ms3544kbC++23799b2024-10-31 15:43:092024-10-31 15:43:27

Judging History

你现在查看的是最新测评结果

  • [2024-10-31 15:43:27]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3544kb
  • [2024-10-31 15:43:09]
  • 提交

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'