QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#693418#9529. Farm ManagementxiaomoWA 0ms3600kbC++20632b2024-10-31 16:06:562024-10-31 16:06:58

Judging History

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

  • [2024-10-31 16:06:58]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3600kb
  • [2024-10-31 16:06:56]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define endl '\n'
typedef long long ll;
typedef struct Node{
	ll w,l,r;
}node;
bool cmp(node a,node b){
	return a.w>b.w;
}
void solve(){
	ll n,m;cin>>n>>m;
	ll ans=0;
	vector<node> a(n);
	ll sm=0;
	for(ll i=0;i<n;i++){
		cin>>a[i].w>>a[i].l>>a[i].r;
		sm+=a[i].w;
	}
	sort(a.begin(),a.end(),cmp);
	ll add=0;
	ll c=m;
	for(ll i=0;i<n;i++){
		ans+=a[i].w*a[i].l;
		m-=a[i].l;
	}
	for(ll i=0;i<n;i++){
		add=max(add,min(m,c-a[i].l)*a[i].w);
	}
	cout<<ans+add;
	return;
}
int main(){
	ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
	solve();
	return 0;
}

详细

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3600kb

input:

5 17
2 3 4
6 1 5
8 2 4
4 3 3
7 5 5

output:

99

result:

wrong answer 1st lines differ - expected: '109', found: '99'