QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#768355#9529. Farm ManagementsurenjamtsWA 0ms3844kbC++20588b2024-11-21 09:36:142024-11-21 09:36:14

Judging History

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

  • [2024-11-21 09:36:14]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3844kb
  • [2024-11-21 09:36:14]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define int long long
#define pb push_back
#define F first
#define S second
signed main(){
	int n, m;
	int w, b, c;
	cin >> n >> m;
	int job = 0;
	vector < pair< int, int > > vc;
	for(int i = 1; i <= n; i ++ ){
		cin >> w >> b >> c;
		vc.pb( {w,c} );
		job += c;
	}	   
	sort( vc.begin(), vc.end() );
	int diff = job - m;
	for(int i = 0; i < vc.size(); i ++ ){
		int temp = min( vc[i].S, diff );
		diff -= temp;
		vc[i].S -= temp;
	}
	int ans = 0;
	for(auto i : vc ){
		ans += i.F*i.S;
	}
	cout << ans << "\n";
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3604kb

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: 3844kb

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'