NEERC 2013, Eastern subregional contest
I. The old Padawan
Memory limit: 64 MB
Input
Output
Sample
input | output |
---|---|
5 1 4 |
8 |
Hint
#include <iostream>
#include <stdio.h>
#include <queue>
#include <stdio.h>
#include <string.h>
#include <vector>
#include <queue>
#include <set>
#include <algorithm>
#include <map>
#include <stack>
#include <math.h>
#define Max(a,b) ((a)>(b)?(a):(b))
#define Min(a,b) ((a)<(b)?(a):(b))
#pragma comment(linker, "/STACK:10240000000000,10240000000000")
using namespace std;
typedef long long LL ;
const int Max_N= ;
int stone[Max_N] ;
int T[Max_N] ,N ,M ,k ;
int Sum_st[Max_N] ;
int find_id(int id){
int Left ,Right ,Mid ,ans;
if(Sum_st[]-Sum_st[id+]<=k)
return ;
Left= ;
Right=id ;
while(Left<=Right){
Mid=(Left+Right)>> ;
if(Sum_st[Mid]-Sum_st[id+]>k){
ans=Mid ;
Left=Mid+ ;
}
else
Right=Mid- ;
}
return ans- ;
}
int gao(){
int stone_j= ,sum ,ans= ;
T[]= ;
for(int i=;i<=M;i++){
/* for(int t=1;t<=T[i]-T[i-1]-1;t++){
stone_j++ ;
ans++ ;
if(stone_j==N)
return ans ;
}*/
stone_j+=(T[i]-T[i-]-) ;
ans+=(T[i]-T[i-]-) ;
if(stone_j>=N)
return ans-(stone_j-N) ;
stone_j=find_id(stone_j) ;
ans++ ;
}
if(stone_j<N)
return ans+N-stone_j ;
}
int main(){
while(scanf("%d%d%d",&N,&M,&k)!=EOF){
for(int i=;i<=N;i++)
scanf("%d",&stone[i]) ;
Sum_st[N+]= ;
for(int i=N;i>=;i--)
Sum_st[i]=Sum_st[i+]+stone[i];
for(int i=;i<=M;i++)
scanf("%d",&T[i]) ;
printf("%d\n",gao()) ;
}
return ;
}
NEERC 2013, Eastern subregional contest的更多相关文章
- NEERC 2014, Eastern subregional contest
最近做的一场比赛,把自己负责过的题目记一下好了. Problem B URAL 2013 Neither shaken nor stirred 题意:一个有向图,每个结点一个非负值,可以转移到其他结点 ...
- NEERC 2010, Eastern subregional contest
只能把补了的题目放这儿了,先留个坑,怕忘记. Problem G URAL 1806 Mobile Telegraphs 题意是:给定n个电话号码,每个号码是一个长度为10的仅含'0'~'9'的字符串 ...
- 2013-2014 ACM-ICPC, NEERC, Eastern Subregional Contest PART (8/10)
$$2013-2014\ ACM-ICPC,\ NEERC,\ Eastern\ Subregional\ Contest$$ \(A.Podracing\) 首先枚举各个折现上的点,找出最小宽度,然 ...
- 2014-2015 ACM-ICPC, NEERC, Eastern Subregional Contest Problem G. The Debut Album
题目来源:http://codeforces.com/group/aUVPeyEnI2/contest/229669 时间限制:1s 空间限制:64MB 题目大意:给定n,a,b的值 求一个长度为n的 ...
- 2014-2015 ACM-ICPC, NEERC, Eastern Subregional Contest Problem H. Pair: normal and paranormal
题目链接:http://codeforces.com/group/aUVPeyEnI2/contest/229669 时间限制:1s 空间限制:64MB 题目大意:给定一个长度为2n,由n个大写字母和 ...
- 2016-2017 ACM-ICPC, NEERC, Southern Subregional Contest (Online Mirror) in codeforces(codeforces730)
A.Toda 2 思路:可以有二分来得到最后的数值,然后每次排序去掉最大的两个,或者3个(奇数时). /************************************************ ...
- 【2015-2016 ACM-ICPC, NEERC, Northern Subregional Contest D】---暑假三校训练
2015-2016 ACM-ICPC, NEERC, Northern Subregional Contest D Problem D. Distribution in Metagonia Input ...
- 2018-2019 ICPC, NEERC, Southern Subregional Contest
目录 2018-2019 ICPC, NEERC, Southern Subregional Contest (Codeforces 1070) A.Find a Number(BFS) C.Clou ...
- 2017-2018 ACM-ICPC, NEERC, Southern Subregional Contest, qualification stage
2017-2018 ACM-ICPC, NEERC, Southern Subregional Contest, qualification stage A. Union of Doubly Link ...
随机推荐
- JQuery移除事件
移除事件 unbind(type [,data]) //data是要移除的函数 $('#btn').unbind("click"); //移除click $('#btn') ...
- LitDB文章
阅读目录 1.LiteDB初步介绍 2.LiteDB使用基本案例 3.LiteDB的技术细节 4.资源其他 今天给大家介绍一个不错的小巧轻量级的NoSQL文件数据库LiteDB.本博客在2013年也介 ...
- NOIP第7场模拟赛题解
NOIP模拟赛第7场题解: 题解见:http://www.cqoi.net:2012/JudgeOnline/problemset.php?page=13 题号为2221-2224. 1.car 边界 ...
- 【linux】之安装mysql常用配置
下载mysql地址 http://dev.mysql.com/downloads/mysql/ 选择下面这个 查看是否存在mysql安装包 rpm -qa|grep -i mysql 删除mysql安 ...
- insmod module_param 模块参数
模块参数 引导模块时,可以向它传递参数.要使用模块参数加载模块,这样写: insmod module.ko [param1=value param2=value ...] 为了使用这些参数的值,要在模 ...
- vs 引用sqlite的问题
错误 4 未能找到类型或命名空间名称“SQLiteCommand”(是否缺少 using 指令或程序集引用?) D:\01学习\SQLite\HBZCSCXT_Mobile\SqlLiteHelper ...
- 75. Sort Colors
Given an array with n objects colored red, white or blue, sort them so that objects of the same colo ...
- scala高级内容(一) Case Class
一. 操作符 自定义操作符 操作付默认左结合调用.除了以:结尾的操作符是右结合调用 object OperaterTest extends App{ val a: myInt = new myInt( ...
- pthread_key_t和pthread_key_create()详解
pthread_key_t和pthread_key_create()详解 下面说一下线程中特有的线程存储, Thread Specific Data .线程存储有什么用了?他是什么意思了?大家都知道, ...
- WLS_Oracle Weblogic安装和环境搭建(案例)
2014-01-03 Created By BaoXinjian