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 ...
随机推荐
- [extjs] ExtJS4 treepanel 子节点选中父节点自动选中,选中父节点 子节点自动全部选中
ExtJS4 treepanel 主要添加viewConfig重的代码: xtype:'treepanel', store: menuStore, id:'menuTreePanel', viewCo ...
- Ruby Numeric
Numeric |-- Float |-- Integer |-- Fixnum |-- Bignum Numeric的基本结构 整数的差异,一般的数字Fixnum就能够处理,即使超过了Fixnum的 ...
- rm命令
rm是一个危险的命令,使用的时候要特别当心,尤其对于新手,否则整个系统就会毁在这个命令(比如在/(根目录)下执行rm * -rf).所以,我们在执行rm之前最好先确认一下在哪个目录,到底要删除什么东西 ...
- VS2010打开项目时,出现“已经在解决方案中打开了具有该名称的项目”问题的解决方案
用的是VSS代码管理.一打开解决方案就看到有个类库不能加载. 解决方法: 直接右键编辑无法加载的类库,或者记事本编辑有问题类库的csproj文件, 删除以下几行: <SccProjectName ...
- lwip:网络数据包读取和解析过程
1. 程序的某处(poll or interrupt)在有数据可读时调用ethernetif_input,该函数依次调用以下函数: 1.1 low_level_input(),将网络数据读入内存: 1 ...
- Window下Nexus私服搭建
项目组大部分人员不能访问maven的central repository,因此在局域网里找一台有外网权限的机器,搭建nexus私服,然后开发人员连到这台私服上 环境是:nexus-2.1.1.mav ...
- IntelliJ IDEA中运行Tomcat报内存溢出(java.lang.OutOfMemoryError: PermGen space)
在Run/Debug Configuration中修改Tomcat的VM options,在里面输入以下内容: -server -XX:PermSize=128M -XX:MaxPermSize=25 ...
- bzoj3905: Square
Description Nothing is more beautiful than square! So, given a grid of cells, each cell being black ...
- Session和Cookie深度剖析
Session和Cookie的区别 具体来说cookie机制采用的是在客户端保持状态的方案,而session机制采用的是在服务器端保持状态的方案.同时我们也看到,由于采用服务器端保持状态的方案在客户端 ...
- 45. Jump Game II
Given an array of non-negative integers, you are initially positioned at the first index of the arra ...