Problem J. CSGO —— 枚举

本文探讨了在CSGO中选择最佳武器组合的方法,通过计算武器的综合评分和性能评价,提出了一个公式来评估主武器和副武器的配合效果。文章详细介绍了如何通过考虑武器之间的性能差异来最大化战斗效能。

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

比赛的时候瞎搞失败,也是问了学长才知道的不能直接一 一匹配暴力,但是我们可以换一种方法暴力,因为他是绝对值,
所以最后对应的状态可能是|xMW[i]xSW[i]|=max(xMW[i]xSW[i],xSW[i]xMW[i])|xMW[i]−xSW[i]|=max(xMW[i]−xSW[i],xSW[i]−xMW[i])
就是说这个武器的每个属性在最后算的时候都有加与减的可能性,我们就暴力这个+-的状态,那么就是1<<k1<<k种情况。
然后每种情况取最大值,到服务器的时候注意,在算sum的时候符号要与主武器的反一下,最后就是answer了

#include<bits/stdc++.h>
using namespace std;
#define ll long long
ll s[10],w[100];
int main()
{
    int t;
    scanf("%d",&t);
    while(t--)
    {
        int n,m,k;
        scanf("%d%d%d",&n,&m,&k);
        for(int i=1;i<=(1<<k);i++)
            w[i]=-1e17;
        for(int i=1;i<=n;i++)
        {
            ll ss;
            scanf("%lld",&ss);
            for(int j=1;j<=k;j++)
                scanf("%lld",&s[j]);
            for(int j=1;j<=(1<<k);j++)
            {
                ll sum=ss;
                int er=j;
                for(int l=1;l<=k;l++)
                {
                    if(er&1)
                        sum+=s[l];
                    else
                        sum-=s[l];
                    er>>=1;
                }
                w[j]=max(w[j],sum);

            }
        }
        ll ans=-1e17;
        for(int i=1;i<=m;i++)
        {
            ll ss;
            scanf("%lld",&ss);
            for(int j=1;j<=k;j++)
                scanf("%lld",&s[j]);
            for(int j=1;j<=(1<<k);j++)
            {
                ll sum=ss;
                int er=j;
                for(int l=1;l<=k;l++)
                {
                    if(er&1)
                        sum-=s[l];
                    else
                        sum+=s[l];
                    er>>=1;
                }
                ans=max(ans,w[j]+sum);
            }
        }
        printf("%lld\n",ans);
    }
    return 0;
}
<!-- 导航栏 --> <div class="nav"> <ul> <li class="menu">首页 <ul class="subMenu"> <li><a href="https://www.csgo.com.cn/main.html">游戏官网</a></li> <li><a href="https://www.pwesports.cn/association">高校电竞社</a></li> <li><a href="https://csgo.wanmei.com/communityserver">社区中心</a></li> </ul> </li> <li class="menu"><a href="#">充值</a></li> <li class="menu">新闻 <ul class="subMenu"> <li><a href="https://www.csgo.com.cn/activity/index.html">活动中心</a></li> <li><a href="https://www.csgo.com.cn/match">赛事中心</a></li> <li><a href="https://www.csgo.com.cn/news/index.html">新闻中心</a></li> </ul> </li> <li class="menu"><a href="#">赛事</a></li> <li class="menu">资料 <ul class="subMenu"> <li><a href="https://www.csgo.com.cn/hd/1704/newerguide/index.html">新手指南</a></li> <li><a href="https://www.csgo.com.cn/hd/1610/info/index.html">官方资料站</a></li> <li><a href="https://www.csgo.com.cn/show">游戏特色</a></li> </ul> </li> <li class="menu"><a href="//wmsjdj.tmall.com/category-1465876517.htm">商城</a></li> <li class="menu">服务 <ul class="subMenu"> <li><a href="https://www.csgo.com.cn/faq/index.html">常见问题</a></li> <li><a href="javascript:void(0);">客服支持</a></li> <li><a href="#">礼包码兑换</a></li> </ul> </li> <li class="menu">注册 <ul class="subMenu"> <li><a href="#">游戏下载</a></li> <li><a href="#">账户注册</a></li> </ul> </li> </ul> </div> 给出css,js文件实现二级菜单
最新发布
06-16
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值