hdu 6435 Problem J. CSGO

19 篇文章 0 订阅

Problem J. CSGO

Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 524288/524288 K (Java/Others)
Total Submission(s): 405    Accepted Submission(s): 197


 

Problem Description

You are playing CSGO.
There are n Main Weapons and m Secondary Weapons in CSGO. You can only choose one Main Weapon and one Secondary Weapon. For each weapon, it has a composite score S.
The higher the composite score of the weapon is, the better for you.
Also each weapon has K performance evaluations x[1], x[2], …, x[K].(range, firing rate, recoil, weight…)
So you shold consider the cooperation of your weapons, you want two weapons that have big difference in each performance, for example, AWP + CZ75 is a good choose, and so do AK47 + Desert Eagle.
All in all, you will evaluate your weapons by this formula.(MW for Main Weapon and SW for Secondary Weapon)


Now you have to choose your best Main Weapon & Secondary Weapon and output the maximum evaluation.

 

 

Input

Multiple query.
On the first line, there is a positive integer T, which describe the number of data. Next there are T groups of data.
for each group, the first line have three positive integers n, m, K.
then, the next n line will describe n Main Weapons, K+1 integers each line S, x[1], x[2], …, x[K]
then, the next m line will describe m Secondary Weapons, K+1 integers each line S, x[1], x[2], …, x[K]
There is a blank line before each groups of data.
T<=100, n<=100000, m<=100000, K<=5, 0<=S<=1e9, |x[i]|<=1e9, sum of (n+m)<=300000

 

 

Output

Your output should include T lines, for each line, output the maximum evaluation for the corresponding datum.

 

 

Sample Input

 

2 2 2 1 0 233 0 666 0 123 0 456 2 2 1 100 0 1000 100 1000 100 100 0

 

 

Sample Output

 

543 2000

 

 

Source

2018 Multi-University Training Contest 10

 

 

Recommend

chendu   |   We have carefully selected several similar problems for you:  6437 6436 6435 6434 6433 

 

题意: 现在要打CS 你可以选择一个主武器和一个副武器,两个武器配合的好,会产生很大的威力,计算方法为上边的式子,你要求出最大的威力是多少?

思路: 5维的一个曼哈顿距离。。。 基本上算是裸题了。 单独考虑一下S就可以。 复杂度2的次方* n

代码:


#include<bits/stdc++.h>

using namespace std;
typedef long long ll;
const int N =1e5+5;
const ll inf =1e18+5;

ll S[N];
ll SS[N];
ll num[N][8];
ll numm[N][8];
int n,m,k;

int main()
{
    int T;
    scanf("%d",&T);
    while(T--)
    {
        scanf("%d %d %d",&n,&m,&k);
        for(int i=1;i<=n;i++){
            scanf("%lld",&S[i]);
            for(int j=0;j<k;j++){
                scanf("%lld",&num[i][j]);
            }
        }

        for(int i=1;i<=m;i++){
            scanf("%lld",&SS[i]);
            for(int j=0;j<k;j++) scanf("%lld",&numm[i][j]);
        }

        int up=(1<<k);
        ll ans=0;
        for(int s=0;s<up;s++){
            ll minn1=inf; ll maxx1=-inf;
            ll minn2=inf; ll maxx2=-inf;

            for(int i=1;i<=n;i++){
                ll now=0;
                for(int j=0;j<k;j++){
                    if(s&(1<<j)) now+=num[i][j];
                    else now-=num[i][j];
                }
                maxx1=max(maxx1,now+S[i]);
                minn1=min(minn1,now-S[i]);
            }

            for(int i=1;i<=m;i++){
                ll now=0;
                for(int j=0;j<k;j++){
                    if(s&(1<<j)) now+=numm[i][j];
                    else now-=numm[i][j];
                }
                maxx2=max(maxx2,now+SS[i]);
                minn2=min(minn2,now-SS[i]);
            }
            ans=max(ans,maxx1-minn2);
            ans=max(ans,maxx2-minn1);
        }
        printf("%lld\n",ans);
    }
    return 0;
}

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值