#include <bits/stdc++.h> using namespace std; typedef long long ll;
typedef double db; const int N = 2e5 + 50;
const int M = 1e5 + 50;
const int Mod = 1e9 + 7; inline int read()
{
int x = 0, f = 1;
char ch = getchar();
while (ch < '0' || ch > '9')
{
if (ch == '-')
f = -1;
ch = getchar();
}
while (ch >= '0' && ch <= '9')
{
x = (x << 1) + (x << 3) + (ch ^ 48);
ch = getchar();
}
return x * f;
} int t, n, k; int w[N], v[N]; signed main()
{
freopen("ball.in", "r", stdin);
freopen("ball.out", "w", stdout);
t = read();
while (t--)
{
n = read(), k = read();
for (int i = 1; i <= n; ++i)
w[i] = read();
sort(w + 1, w + n + 1);
for (int i = 1; i <= k; ++i)
v[i] = read() - 1;
sort(v + 1, v + k + 1);
ll res = 0;
int r = n;
for (int i = 1; i <= k; ++i)
{
if (!v[i])
res += w[r] * 2;
else
res += w[r];
r--;
}
for (int i = 1; i <= k; ++i)
{
if (!v[i])
continue;
res += w[r - v[i] + 1];
r -= v[i];
}
printf("%lld\n", res);
}
return 0;
}

#include <bits/stdc++.h> using namespace std; typedef long long ll;
typedef double db; #define int long long const int N = 1e2 + 50;
const int M = 1e3 + 50;
const int Mod = 1e9 + 7; inline int read()
{
int x = 0, f = 1;
char ch = getchar();
while (ch < '0' || ch > '9')
{
if (ch == '-')
f = -1;
ch = getchar();
}
while (ch >= '0' && ch <= '9')
{
x = (x << 1) + (x << 3) + (ch ^ 48);
ch = getchar();
}
return x * f;
} int t, n, m; int a[N], b[N]; int f[M]; // int q[M]; signed main()
{
freopen("group.in", "r", stdin);
freopen("group.out", "w", stdout);
t = read();
while (t--)
{
n = read(), m = read();
for (int i = 1; i <= n; ++i)
a[i] = read();
for (int i = 1; i <= n; ++i)
b[i] = read();
memset(f, 0, sizeof(f));
f[0] = 1;
for (int i = 1; i <= n; ++i)
{
for (int r = m; r > m - a[i]; --r)
{
for (int j = r; j >= a[i]; j -= a[i])
{
for (int k = 1; k <= b[i]; ++k)
{
if (j >= k * a[i])
f[j] = (f[j] + f[j - k * a[i]]) % Mod;
else
break;
}
}
}
}
int res = 0;
for (int i = 1; i <= m; ++i)
{
res = (res + f[i]) % Mod;
}
printf("%lld\n", res);
}
return 0;
}

#include <bits/stdc++.h> using namespace std; typedef long long ll;
typedef double db; const int N = 3e2 + 50;
const int M = 1e5 + 50;
const int Mod = 1e9 + 7; inline int read()
{
int x = 0, f = 1;
char ch = getchar();
while (ch < '0' || ch > '9')
{
if (ch == '-')
f = -1;
ch = getchar();
}
while (ch >= '0' && ch <= '9')
{
x = (x << 1) + (x << 3) + (ch ^ 48);
ch = getchar();
}
return x * f;
} int t, n; int v[N]; int a[N][N], f[N][N]; int main()
{
freopen("match.in", "r", stdin);
freopen("match.out", "w", stdout);
t = read();
while (t--)
{
n = read();
for (int i = 1; i <= n; ++i)
v[i] = read();
for (int i = 1; i <= n; ++i)
{
for (int j = 1; j <= n; ++j)
{
a[i][j] = read();
}
}
memset(f, 0, sizeof(f));
for (int i = 0; i <= n; ++i)
f[i][i] = i;
for (int len = 1; len <= n; ++len)
{
for (int l = 1; l <= n - len + 1; ++l)
{
int r = l + len - 1;
for (int k = l; k < r; ++k)
{
if (a[f[l][k]][f[k + 1][r]])
{
if (v[f[l][r]] < v[f[l][k]])
{
f[l][r] = f[l][k];
}
}
else
{
if (v[f[l][r]] < v[f[k + 1][r]])
{
f[l][r] = f[k + 1][r];
}
}
}
}
}
printf("%d\n", v[f[1][n]]);
}
return 0;
}

#include <bits/stdc++.h> using namespace std; typedef long long ll;
typedef double db; const int N = 2e5 + 50;
const int M = 1e5 + 50;
const int Mod = 1e9 + 7; inline int read()
{
int x = 0, f = 1;
char ch = getchar();
while (ch < '0' || ch > '9')
{
if (ch == '-')
f = -1;
ch = getchar();
}
while (ch >= '0' && ch <= '9')
{
x = (x << 1) + (x << 3) + (ch ^ 48);
ch = getchar();
}
return x * f;
} int t, n, k, MX; int a[N]; priority_queue<int, vector<int>, greater<int>> s, CLEAR; bool check(int x)
{
s = CLEAR;
for (int i = 1; i < k; ++i)
s.push(a[i]);
for (int i = k; i <= n; ++i)
{
s.push(a[i]);
if (x >= s.top())
x += s.top();
else
return false;
s.pop();
if (x >= MX)
return true;
}
for (int i = 1; i < k; ++i)
{
if (x >= s.top())
x += s.top();
else
return false;
s.pop();
if (x >= MX)
return true;
}
return true;
} signed main()
{
freopen("monster.in", "r", stdin);
freopen("monster.out", "w", stdout);
t = read();
while (t--)
{
n = read(), k = read();
MX = 0;
for (int i = 1; i <= n; ++i)
a[i] = read(), MX = max(MX, a[i]); int l = 0, r = 1e9, ans = Mod;
while (l < r)
{
int mid = l + r >> 1;
if (check(mid))
{
ans = min(ans, mid);
r = mid;
}
else
{
l = mid + 1;
}
}
printf("%d\n", ans);
}
return 0;
}

7.28 EOI的更多相关文章

  1. Linux Kernel 2.6.28 以上有BUG,系统运行第208.5天down机

    简介: 业务服务器有一台服务器出现意外down机,服务器ping 不通.无法登陆,本想通过公司KVM系统登陆系统重启解决,登陆KVM后发现系统屏幕打印大量的内核错误,KVM无法使用.无法发送重启服务器 ...

  2. 28个你必须知道的HTML5的新特性,技巧以及技术

    崭新新的页面布局 传统的: HTML5: 1. 新的Doctype 尽管使用<!DOCTYPE html>,即使浏览器不懂这句话也会按照标准模式去渲染 2. Figure元素 用<f ...

  3. CSharpGL(28)得到高精度可定制字形贴图的极简方法

    CSharpGL(28)得到高精度可定制字形贴图的极简方法 回顾 以前我用SharpFont实现了解析TTF文件从而获取字形贴图的功能,并最终实现了用OpenGL渲染文字. 使用SharpFont,美 ...

  4. 来,一起让我们越来越懒,面向CSS、JS未来编程。(9.28已更新)

    2016.10.29更新 本文存在大量的错误,仅供参考. 不知不觉在前端领域马上一个年头就要过去了,然而再看看自己的代码,果然够烂,那么为什么代码一直没有用面向对象的思维去写CSS呢?首先有两点:一点 ...

  5. MySQL报错:Got error 28 from storage engine

    今天碰到数据库出错: Got error 28 from storage engine 查了一下,数据库文件所在的盘应该没事,应该是数据库用的临时目录空间不够 问题原因: 磁盘临时空间不够导致. 解决 ...

  6. [.net 面向对象程序设计进阶] (28) 结束语——告别2015

    [.net 面向对象程序设计进阶] (28) 结束语——告别2015 <.net面向对象程序设计进阶>这一系列文章写了太长的时间了,大概有半年没写,在年底又一口气写了好几篇.在整个过程中目 ...

  7. 背水一战 Windows 10 (28) - 控件(文本类): TextBox, PasswordBox

    [源码下载] 背水一战 Windows 10 (28) - 控件(文本类): TextBox, PasswordBox 作者:webabcd 介绍背水一战 Windows 10 之 控件(文本类) T ...

  8. 10月28日PHP基础知识测试题

    本试题共40道选择题,10道判断题,考试时间1个半小时 一:选择题(单项选择,每题2分): 1. LAMP具体结构不包含下面哪种(A) A:Windows系统 B:Apache服务器 C:MySQL数 ...

  9. CentOS6.3编译安装Nginx1.4.7 + MySQL5.5.25a + PHP5.3.28

    [准备工作] #在编译安装lnmp之前,首先先卸载已存在的rpm包. rpm -e httpd rpm -e mysql rpm -e php yum -y remove httpd yum -y r ...

  10. 记 Mac Pro 系统升级后,编译安装 PHP-5.6.28 / PHP-7.0 报错修复过程

    买 Mac Pro 的时候,系统为 OS X 10.11.5,编译 PHP-5.6.21 的时候,也遇到一些坑,安装过程记录如下: Mac Pro 编译安装 PHP 5.6.21 及 问题汇总 后来, ...

随机推荐

  1. 每日一题 力扣 445 https://leetcode.cn/problems/add-two-numbers-ii/

    可以直接用栈去做就行,逆序想到栈的做法 然后算完一个就直接赋值给答案数组  我用的是常见 public ListNode addTwoNumbers(ListNode l1, ListNode l2) ...

  2. RabbitMQ 多消费者 使用单信道和多信道区别

    RabbitMQ 多个消费者共用一个信道实例 与 每个消费者使用不同的信道实例 区别: 1. 多个消费者共用一个信道实例:这种方式下,多个消费者共享同一个信道实例来进行消息的消费. 优点:这样可以减少 ...

  3. linux150常用命令

    Linux最常用150个命令汇总 线上查询及帮助命令(2个) man 查看命令帮助,命令的词典,更复杂的还有info,但不常用. help 查看Linux内置命令的帮助,比如cd命令. 文件和目录操作 ...

  4. 基于 Probe 的实时全局光照方案(Probe-based Global Illumination)

    目录 Precomputed Probe 预放置 probes 四面体镶嵌(Tetrahedral Tessellations) Indirect Light Cache Volumetric Lig ...

  5. 面霸的自我修养:Java线程专题

    王有志,一个分享硬核Java技术的互金摸鱼侠加入Java人的提桶跑路群:共同富裕的Java人 平时我在网上冲浪的时候,收集了不少八股文和面试文,内容虽然多,但质量上良莠不齐,主打一个不假思索的互相抄, ...

  6. ListView选中获取数据并弹出菜单项

    前言 作为一名Android小白,我在编写过程中,使用ListView列表,想要使用他来完成长按弹出菜单选项,并且还要进行事件操作,经过百度编程的经历后,终于成功完成.在此附上这块比较完整的代码,理论 ...

  7. 打造原生 WebGL 2D 引擎:一场创意与技术的融合

    打造原生 WebGL 2D 引擎:一场创意与技术的融合 1.引言 在当今数字化时代,网页的功能越来越丰富,已经远远超越了传统的文本和图片呈现.我们生活在一个充满交互性和视觉魅力的网络世界.每天都会遇到 ...

  8. Kubernets常用命令

    查看所有namespace的pods运行情况 kubectl get pods --all-namespaces kubectl get service -ALL kubectl get deploy ...

  9. Angular与AngularJS区别

    简单介绍 目前 Angular 2 到現在 Angular 11 都是十分穩定的改版,不再出現之前 Angular 1.x 到 Angular 2.x 的哀鴻遍野. 因此目前市面上確實同時存在著兩種差 ...

  10. 个人用C#编写的壁纸管理器 - 开源研究系列文章

    今天介绍一下笔者自己用C#开发的一个小工具软件:壁纸管理器. 开发这个小工具的初衷是因为Windows操作系统提供的功能个人不满意,而且现在闲着,所以就随意写了个代码.如果对读者有借鉴参考作用就更好了 ...