hdu-6435
Problem J. CSGO
Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 524288/524288 K (Java/Others)
Total Submission(s): 272 Accepted Submission(s): 135
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.
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
2 2 1
0 233
0 666
0 123
0 456
2 2 1
100 0 1000 100 1000 100
100 0
2000
#include<bits/stdc++.h>
using namespace std;
#define LL long long
#define mp make_pair
#define pb push_back
#define inf 0x7fffffffff
#define pii pair<int,int>
int x[][];
LL a[]={};
int main()
{
int t,n,m,i,j,k;
cin>>t;
while(t--){
scanf("%d%d%d",&n,&m,&k);
for(i=;i<=n;++i)
for(j=;j<k+;++j) scanf("%d",&x[i][j]);
for(i=;i<=m;++i)
for(j=;j<k+;++j) scanf("%d",&x[i+n][j]);
LL ans=-inf;
for(i=;i<(<<k);++i){
for(j=;j<k;++j)a[j+]=(i&(<<j))?:-;
LL mx1=-inf,mx2=-inf,tmp=;
for(j=;j<=n;++j){
tmp=x[j][];
for(int o=;o<k+;++o){
tmp+=a[o]*x[j][o];
}
if(tmp>mx1)mx1=tmp;
}
for(j=n+;j<=n+m;++j){
tmp=x[j][];
for(int o=;o<k+;++o){
tmp-=a[o]*x[j][o];
}
if(tmp>mx2)mx2=tmp;
}
if(mx1+mx2>ans)ans=mx1+mx2;
}
cout<<ans<<endl;
}
return ;
}
hdu-6435的更多相关文章
- hdu 6435 CSGO(最大曼哈顿距离)
题目链接 Problem Description You are playing CSGO. There are n Main Weapons and m Secondary Weapons in C ...
- HDU - 6435 Problem J. CSGO 2018 Multi-University Training Contest 10 (二进制枚举+思维)
题意:有N个主武器(MW)和M个副武器(SW),每个武器都有自己的S值,和K个附加属性xi.要选取一对主副武器搭配,搭配后获得的性能由该公式得出: 求获得最大的性能为多少. 分析:由于|xm - xs ...
- 2018 Multi-University Training Contest 10 CSGO(HDU - 6435)(最远曼哈顿距离)
有 n 种主武器,m 种副武器.每种武器有一个基础分数k种属性值 X[i] . 选出一种主武器 mw 和一种副武器 sw,使得两种武器的分数和 + 每个属性的差值尽量大.(参考下面的式子) 多维的最远 ...
- hdu 6435 CSGO
题意:现在有n个主武器, m个副武器, 你要选择1个主武器,1个副武器, 使得 题目给定的那个式子最大. 题解:这个题目困难的地方就在于有绝对值,| a - b | 我们将绝对值去掉之后 他的值就为 ...
- HDU - 6435 Problem J. CSGO (曼哈顿距离变换)
题目大意:有两类武器(主武器和副武器),每类有若干把,每把武器都有一个基础属性S,以及k个附加属性,让你选一把主武器M和一把副武器S,使得最大. 显然后面的和式是一个k维的曼哈顿距离,带绝对值符号不好 ...
- hdu 6435 /// 状压
题目大意: 给定 n m k 为 n种主武器 m种副武器 武器有k种属性 接下来n行 先给定当前主武器的综合分s1 再给定k种属性的值 接下来m行 先给定当前副武器的综合分s2 再给定k种属性的值 要 ...
- HDOJ 2111. Saving HDU 贪心 结构体排序
Saving HDU Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total ...
- 【HDU 3037】Saving Beans Lucas定理模板
http://acm.hdu.edu.cn/showproblem.php?pid=3037 Lucas定理模板. 现在才写,noip滚粗前兆QAQ #include<cstdio> #i ...
- hdu 4859 海岸线 Bestcoder Round 1
http://acm.hdu.edu.cn/showproblem.php?pid=4859 题目大意: 在一个矩形周围都是海,这个矩形中有陆地,深海和浅海.浅海是可以填成陆地的. 求最多有多少条方格 ...
- HDU 4569 Special equations(取模)
Special equations Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u S ...
随机推荐
- Java创建对象的几种方式。
Java创建对象的几种方式(重要): (1) 用new语句创建对象,这是最常见的创建对象的方法. (2) 运用反射手段,调用java.lang.Class或者java.lang.reflect.Con ...
- EPPlus实战篇——Excel写入
.net core 项目 可以向excel写入任何类型(T)的数据,只要T中的field的[Display(Name = "1233", Description = "# ...
- A Simple Note on "P4FPGA: A Rapid Prototyping Framework for P4"
论文:P4FPGA: A Rapid Prototyping Framework for P4 Github:https://github.com/p4fpga Reference: Han Wang ...
- 轮播图(jQuery)
效果图: -----------------------------------------html------------------------------------------------- ...
- RN中关于IOS和Android的相关权限的问题
在日常的开发中,时常需要去获取应用的一权限 比如查看通讯录/打开摄像机等 1:ios iOS 的权限管理在info.plist里设置 info.plist主要是管理了app 的一些信息文件,比如版本 ...
- composer require 指定版本
默认 composer require endroid/qr-code 指定版本 composer require endroid/qr-code 1.9.3 # composer require e ...
- 设计模式(五)Builder Pattern建造者模式
在我们日常生活中,如构建一个飞船,一个手机,一栋建筑,都会有非常复杂的组装,这时候应该用到建造者模式 以建造一个飞船为例 案例:造小页飞船 1.飞船各部分元件 package com.littlepa ...
- [osg][osgEarth][osgGA][原] EarthManipulator------基于oe的相机漫游器(浅析)
知识基础:osg漫游器基础 class OSGEARTHUTIL_EXPORT EarthManipulator : public osgGA::CameraManipulator EarthMani ...
- git报错fatal: loose object ....(stored in .git/objects/....) is emtpy
主要是非正常关机.把.git给破坏了 参考https://stackoverflow.com/questions/12571557/fixing-a-corrupt-loose-object-as-a ...
- 牛客OI周赛6-提高组 A 大法师与魔法石
大法师与魔法石 思路: 对于一个ai, 它可以构成区间[ai/v, ai] 假设和它相邻的为aj, 那么ai 和 aj 构成的区间为[(ai+aj) / v, ai+aj] 那么这两个区间能合并的条件 ...