#include <iostream>
#include <vector> using namespace std; int main(){
int m,sum = ;
cin >> m ;
vector<int> c(m+,);
for(int i = ; i <= m ; ++ i) {cin >> c[i];sum+=c[i];}
int x,y,firstPart = , secondPart = ,firstIndex = , secondIndex =;
cin >> x >> y;
for(firstIndex = ,secondIndex = m+;firstIndex < secondIndex;){
if (firstPart < x) firstPart+=c[++firstIndex];
if (secondPart < x) secondPart += c[--secondIndex];
if( firstPart >= x && secondPart >= x ) break;
}
if(firstPart > y || secondPart > y) cout<<<<endl;
else{
if(firstIndex >= secondIndex) cout<<<<endl;
else{
if(sum - firstPart - secondPart > *(y-x)) cout<<<<endl;
else{
while(secondPart + c[secondIndex-]<= y && (secondIndex-) > firstIndex){
secondIndex--;
secondPart+=c[secondIndex];
}
if (secondIndex- <= firstIndex) cout<<secondIndex<<endl;
else{
if(sum - secondPart > y) cout<<<<endl;
else cout<<secondIndex<<endl;
}
}
}
}
}

最新文章

  1. atitit.TokenService v3 qb1 &#160;token服务模块的设计 新特性.docx
  2. No suitable driver found for jdbc:mysql://localhost:3306/dmc
  3. Linux 使用 su 切换用户提示 Authentication Failure 的解决方法
  4. ORA-15063: ASM discovered an insufficient number of disks for diskgroup &quot;ASM,KEL&quot;
  5. 我的第一个Hibernate程序
  6. Windows下Apache部署Django过程记录
  7. (转) CS0234: 命名空间“System.Web.Mvc”中不存在类型或命名空间名称“Ajax”(是否缺少程序集引用?)
  8. new和instanceof的内部机制
  9. js getByClass函数封装
  10. HTTP协议 状态码 telnet 笔记分享
  11. java map遍历、排序,根据value获取key
  12. [POI 2004]SZP
  13. Angular2+ 实现组件交互的众多方式
  14. 【Android】Android的进程优先级
  15. EZ 2018 05 06 NOIP2018 慈溪中学集训队互测(五)
  16. Ibatis.Net 表连接查询学习(五)
  17. iOS学习之VFL语言简介
  18. AWS CLI以及AWS S3 SYNC命令行使用
  19. CentOS 下安装 OpenOffice4.0
  20. android程序监听home键与电源键

热门文章

  1. PHP随笔
  2. django静态文件查找逻辑
  3. python中import和from...import...的区别
  4. shell 生成指定范围随机数与随机字符串 .
  5. 【Hibernate】Hibernate系列8之管理session
  6. POJ 3083
  7. 43. 动态规划求解n个骰子的点数和出现概率(或次数)[Print sum S probability of N dices]
  8. Java操作Session与Cookie
  9. Road Construction(poj 3352)
  10. vector容器+iterator迭代器