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 ...
随机推荐
- kubernetes 实战5_命令_Assign Pods to Nodes&Configure a Pod to Use a ConfigMap
Assign Pods to Nodes how to assign a Kubernetes Pod to a particular node in a Kubernetes cluster. Ad ...
- dRMT: Disaggregated Programmable Switching, SIGCOMM17
Reference: dRMT, SIGCOMM 2017 今年的SIGCOMM17会议上,Cisco System和MIT的团队针对RMT模型现有的问题,合作发表了这篇"dRMT: Dis ...
- 免费api
聚合数据提供30大类,100种以上基础数据API服务,国内最大的基础数据API服务,下面就罗列一些免费的各类API接口. 聚合的免费API接口数据: 手机号码归属地API接口:https://www. ...
- Jenkins--Credentials添加证书从git上拉代码
直接上图:
- 二: vue的属性及功能,axios
一: 过滤器 1. 定义: 过滤器,就是vue允许开发者自定义的文本格式化函数,可以使用在两个地方:输出内容和操作数据中. 定义过滤器的方式有两种. 2.使用vue.filter()进行全局定义 ...
- ubuntu16系统磁盘空间/dev/vda1占用满的问题
参考文档: https://www.cnblogs.com/moonandstar08/p/6091507.html (系统磁盘空间/dev/xvda1占满原因分析) https://blog.csd ...
- [转][osg][QT]osg与QT界面结合的简单例子
//QT += core gui opengl //LIBS += -losgViewer -losgDB -losgUtil -losg -lOpenThreads -losgGA -losgQt ...
- Linux下解包/打包,压缩/解压命令
.tar 解包:tar xvf FileName.tar 打包:tar cvf fileName.tar DirName tar.gz和.tgz 解压:tar zxvf FileName.tar.zi ...
- nginx反向代理实例
通过一个例子演示一下nginx是如何代理服务的,并且讲一下nginx.conf的关于server模块和location模块的配置 server模块:配置虚拟主机的相关参数,一个http中可以有多个se ...
- 细胞迁移 | cell migration
一些基本概念: intracellular biochemical signaling pathways:胞内生化信号通路 extracellular mechanical cues: 胞外机械信号 ...