QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#693133#9529. Farm ManagementSocialPandaWA 0ms3852kbC++231.7kb2024-10-31 15:36:102024-10-31 15:36:11

Judging History

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

  • [2024-10-31 15:36:11]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3852kb
  • [2024-10-31 15:36:10]
  • 提交

answer

#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")

#include <bits/stdc++.h>
//#define int long long
//#define LL long long
#define double long double
//#define lf Lf
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define endl "\n"
#define PII pair<int,int>
#define Gheap priority_queue<int,vector<int>,greater<int>>
#define Lheap priority_queue<int>
#define MAXN 0x3f3f3f3f
#define MINN -0x3f3f3f3f
using namespace std;
//const int N=1e6+100,M=2*N;
//int e[N],w[M],h[M],ne[M],idx;

typedef struct {
	int w;
	int a;
	int b;
} corn;

void solve()
{
	int n,k;
	cin>>n>>k;
	int maxx=0;
	int ans=0;
	vector<corn> vec;vec.pb({0,0,0});

	int all_min_cnt=0,all_max_cnt=0;
	int all_min_val=0,all_max_val=0;

	for(int i=1;i<=n;i++)
	{
		int w,a,b;
		cin>>w>>a>>b;
		vec.pb({w,a,b});
		all_min_val+=a*w;
		all_min_cnt+=a;

		all_max_val+=b*w;
		all_max_cnt+=b;
	}

	for(int i=1;i<=n;i++)
	{
		//放开对i限制,其他谷物按最小的搞,剩下的用来处理i
		int cw = vec[i].w;
		int ca = vec[i].a;
		int cb = vec[i].b;

		int cur_val = all_min_val;
		int res_cnt = k - all_min_cnt;
		cur_val += res_cnt * cw; 
		ans=max(ans,cur_val);
	}

	for(int i=1;i<=n;i++)
	{
		//放开对i限制,其他谷物按最大的搞,剩下的用来处理i
		int cw = vec[i].w;
		int ca = vec[i].a;
		int cb = vec[i].b;

		int cur_val = all_max_val;
		int res_cnt = k - all_max_cnt;
		cur_val += res_cnt * cw; 
		ans=max(ans,cur_val);
	}

	cout<<ans<<endl;
    
}
/*
*/
int main()
{
    std::ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int tt=1;
    //cin >> tt;
    while(tt--) solve();
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

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

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:

44007019

result:

wrong answer 1st lines differ - expected: '35204500', found: '44007019'