BestCoder Round #3
Task schedule http://acm.hdu.edu.cn/showproblem.php?pid=4907
#include<cstdio>
#include<cstring>
#define mt(a,b) memset(a,b,sizeof(a))
const int M=;
int a[M];
bool vis[M];
int main(){
int t,n,m;
while(~scanf("%d",&t)){
while(t--){
scanf("%d%d",&n,&m);
mt(vis,);
for(int i=;i<=n;i++){
scanf("%d",&a[i]);
vis[a[i]]=true;
}
int x=;
for(int i=;i<=;i++){
if(!vis[i]){
for(int j=x;j<=i;j++){
a[j]=i;
}
x=i+;
}
}
while(m--){
scanf("%d",&x);
printf("%d\n",a[x]);
}
}
}
return ;
}
end
BestCoder Round #3的更多相关文章
- BestCoder Round #89 02单调队列优化dp
1.BestCoder Round #89 2.总结:4个题,只能做A.B,全都靠hack上分.. 01 HDU 5944 水 1.题意:一个字符串,求有多少组字符y,r,x的下标能组成等比数列 ...
- BestCoder Round #90 //div all 大混战 一题滚粗 阶梯博弈,树状数组,高斯消元
BestCoder Round #90 本次至少暴露出三个知识点爆炸.... A. zz题 按题意copy Init函数 然后统计就ok B. 博弈 题 不懂 推了半天的SG..... 结果这 ...
- bestcoder Round #7 前三题题解
BestCoder Round #7 Start Time : 2014-08-31 19:00:00 End Time : 2014-08-31 21:00:00Contest Type : ...
- Bestcoder round #65 && hdu 5593 ZYB's Tree 树形dp
Time Limit: 3000/1500 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others)Total Submissio ...
- Bestcoder round #65 && hdu 5592 ZYB's Premutation 线段树
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others)Total Submissio ...
- 暴力+降复杂度 BestCoder Round #39 1002 Mutiple
题目传送门 /* 设一个b[]来保存每一个a[]的质因数的id,从后往前每一次更新质因数的id, 若没有,默认加0,nlogn复杂度: 我用暴力竟然水过去了:) */ #include <cst ...
- 贪心 BestCoder Round #39 1001 Delete
题目传送门 /* 贪心水题:找出出现次数>1的次数和res,如果要减去的比res小,那么总的不同的数字tot不会少: 否则再在tot里减去多余的即为答案 用set容器也可以做,思路一样 */ # ...
- BestCoder Round #88
传送门:BestCoder Round #88 分析: A题统计字符串中连续字串全为q的个数,预处理以下或加个cnt就好了: 代码: #include <cstdio> #include ...
- BestCoder Round #69 (div.2) Baby Ming and Weight lifting(hdu 5610)
Baby Ming and Weight lifting Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K ( ...
- BestCoder Round #68 (div.2) tree(hdu 5606)
tree Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submis ...
随机推荐
- IOS自定义场景切换动画。
IOS中我们可以通过Storyborad以及segue来实现我们自己的场景切换动画,新建项目使用Single View Application模板并取名为MyCustomSegue. 使用storyb ...
- iOS-单例模式-使用技巧
SingleModel-单例模式 单例可以保证在程序运行过程,一个类只有一个实例(一个对象) 一般将单例设置成宏,这样在使用的时候可以很方便. 我们可以按照下面的步骤实现单例 1.自定义一个.h文件, ...
- 关于datatable转换datatime类型的问题
今天转换datatable 属性值的时候出错: DataTable dt_1 = new DataTable();dt_1 = new BLL.auction().GetList_pmh(top, _ ...
- c#中SqlHelper类的编写(三)
下面我们直接用可变长度参数的方式写一个完整的SqlHelper增删改public static int ExecuteNonQuery(string sql,params Parameter[] pa ...
- SQL 建表与查询 HTML计算时间差
create database xue1 go --创建数据库 use xue1 go --引用数据库 create table xinxi ( code int, name ), xuehao ), ...
- oracle11.0.2 64位版本 Toad连接
今天重装了系统 oracle oracle客户端 之前连不上toad 今天总结 客户端路径:E:\app\ruonanxiao-pc\product\11.2.0\client_1 服务端路径:E: ...
- Silverlight浮动窗体 floatablewindow 非模态对话框
1.http://www.cnblogs.com/yinxiangpei/articles/2613913.html 说明:Silverlight的ChildWindow组件给我们的开发带来了便利,比 ...
- Mongodb地理空间索引
1.索引: 建立索引既耗时也费力,还需要消耗很多资源.使用{"bakckground":true}选项可以使这个过程在后台完成,同时正常处理请求.如果不包括background 这 ...
- struts2 知识梳理
写此文章时,最新struts2版本:2.3.6 一:struts.xml配置详解: 1.<include> 表示引入其他配置文件 2.<constant> 定义常量 3.< ...
- Firebird数据库相关备忘录
Firebird数据库中有一些很特别的东西,很好用,但由于平时用的不多,记在这里,以备以后用到时查询. 1.以ADO 的OLE ODBC驱动方式访问 Firebird,可以使用如下连接串: FBCon ...