题目大意:

给定n k

给定主角具有的k种属性

给定n个怪兽具有的k种属性和打死该怪兽后能得到的k种属性对应增幅

求主角最多能打死多少怪兽和最终主角的k种属性

k最大为5 开5个优先队列贪心

快速读入模板

#include <bits/stdc++.h>
using namespace std; #define reads(n) FastIO::read(n)
namespace FastIO {
const int SIZE = << ;
char buf[SIZE], obuf[SIZE], str[];
int bi = SIZE, bn = SIZE, opt;
int read(char *s) {
while (bn) {
for (; bi < bn && buf[bi] <= ' '; bi++);
if (bi < bn) break;
bn = fread(buf, , SIZE, stdin);
bi = ;
}
int sn = ;
while (bn) {
for (; bi < bn && buf[bi] > ' '; bi++) s[sn++] = buf[bi];
if (bi < bn) break;
bn = fread(buf, , SIZE, stdin);
bi = ;
}
s[sn] = ;
return sn;
}
bool read(int& x) {
int n = read(str), bf;
if (!n) return ;
int i = ; if (str[i] == '-') bf = -, i++; else bf = ;
for (x = ; i < n; i++) x = x * + str[i] - '';
if (bf < ) x = -x;
return ;
}
}; int main()
{
int n; reads(n);
return ;
}
#include <bits/stdc++.h>
using namespace std;
#define LL long long
#define INF 0x3f3f3f3f
#define mem(i,j) memset(i,j,sizeof(i))
const int N=1e5+; #define reads(n) FastIO::read(n)
namespace FastIO {
const int SIZE = << ;
char buf[SIZE], obuf[SIZE], str[];
int bi = SIZE, bn = SIZE, opt;
int read(char *s) {
while (bn) {
for (; bi < bn && buf[bi] <= ' '; bi++);
if (bi < bn) break;
bn = fread(buf, , SIZE, stdin);
bi = ;
}
int sn = ;
while (bn) {
for (; bi < bn && buf[bi] > ' '; bi++) s[sn++] = buf[bi];
if (bi < bn) break;
bn = fread(buf, , SIZE, stdin);
bi = ;
}
s[sn] = ;
return sn;
}
bool read(int& x) {
int n = read(str), bf;
if (!n) return ;
int i = ; if (str[i] == '-') bf = -, i++; else bf = ;
for (x = ; i < n; i++) x = x * + str[i] - '';
if (bf < ) x = -x;
return ;
}
}; int n,k;
int v[],a[N][];
struct NODE{
int x,id;
bool operator <(const NODE& p)const {
return x>p.x;
}
};
priority_queue<NODE> q[]; int main()
{
int t; reads(t);
while(t--) {
reads(n); reads(k);
for(int i=;i<k;i++)
while(!q[i].empty()) q[i].pop();
for(int i=;i<k;i++)
reads(v[i]);
for(int i=;i<n;i++)
for(int j=;j<*k;j++)
reads(a[i][j]);
for(int i=;i<n;i++)
q[].push({a[i][],i});
int ans=;
while() {
bool OK=;
for(int i=;i<k;i++) {
while(!q[i].empty()) {
NODE t=q[i].top();
if(t.x<=v[i]) {
q[i].pop();
if(i==k-) {
ans++; OK=;
for(int j=;j<k;j++)
v[j]+=a[t.id][j+k];
} else {
t.x=a[t.id][i+];
q[i+].push(t);
}
} else break;
}
}
if(!OK) break;
}
printf("%d\n",ans);
for(int i=;i<k;i++) {
printf("%d",v[i]);
if(i==k-) printf("\n");
else printf(" ");
}
} return ;
}

最新文章

  1. js自动提示查询添加功能(不是自动补全)
  2. Spring和SpringMVC父子容器关系初窥
  3. plist文件的读取和xib加载cell
  4. Cocos2dx.3x入门三部曲-Hello Game项目创建(二)
  5. groovy–运算符重载
  6. 【转】设计模式(九)外观模式Facade(结构型)
  7. Android:文件夹显示红色叹号
  8. java.lang.UnsupportedClassVersionError(java项目版本一致问题)
  9. Eclipese Mars安装SVN的全步骤
  10. thymeleaf中的日期格式化
  11. Spring MVC Ajax 复杂参数的批量传递
  12. 并发之痛 Thread,Goroutine,Actor
  13. 通过awk 和 sed 将多余的列剔除
  14. Java中的回车换行符/n /r /t
  15. fffmgg
  16. layout_weight 全解析
  17. python第四十三课——封装性
  18. Activity四种启动模式之singleTask应用
  19. 浅谈为什么一个java源文件中只能有一个public类?
  20. Eclipse软件使用说明

热门文章

  1. 【Neo4j查询优化系列】如何快速统计节点的关系数
  2. linux文本处理工具篇
  3. 无法启动此程序 ,因为计算机中丢失MSVCP120.dll
  4. DoubleCache
  5. JNI Hello World
  6. 企业级NginxWeb服务优化实战(上)
  7. MVC+EF三层+抽象工厂
  8. 【精通css读书笔记】 第八章 布局
  9. applicationContext-redis.xml配置文件
  10. PHP ftp_cdup() 函数