Problem Statement

Takahashi is exploring a cave in a video game.

The cave consists of $N$ rooms arranged in a row. The rooms are numbered Room $1,2,\ldots,N$ from the entrance.

Takahashi is initially in Room $1$, and the time limit is $T$.

For each $1 \leq i \leq N-1$, he may consume a time of $A_i$ to move from Room $i$ to Room $(i+1)$. There is no other way to move between rooms.
He cannot make a move that makes the time limit $0$ or less.

There are $M$ bonus rooms in the cave. The $i$-th bonus room is Room $X_i$; when he arrives at the room, the time limit increases by $Y_i$.

Can Takahashi reach Room $N$?

Constraints

  • $2 \leq N \leq 10^5$
  • $0 \leq M \leq N-2$
  • $1 \leq T \leq 10^9$
  • $1 \leq A_i \leq 10^9$
  • $1 < X_1 < \ldots < X_M < N$
  • $1 \leq Y_i \leq 10^9$
  • All values in input are integers.

Input

Input is given from Standard Input in the following format:

$N$ $M$ $T$
$A_1$ $A_2$ $\ldots$ $A_{N-1}$
$X_1$ $Y_1$
$X_2$ $Y_2$
$\vdots$
$X_M$ $Y_M$

Output

If Takahashi can reach Room $N$, print Yes; otherwise, print No.


Sample Input 1

4 1 10
5 7 5
2 10

Sample Output 1

Yes
  • Takahashi is initially in Room $1$, and the time limit is $10$.
  • He consumes a time of $5$ to move to Room $2$. Now the time limit is $5$. Then, the time limit increases by $10$; it is now $15$.
  • He consumes a time of $7$ to move to Room $3$. Now the time limit is $8$.
  • He consumes a time of $5$ to move to Room $4$. Now the time limit is $3$.

Sample Input 2

4 1 10
10 7 5
2 10

Sample Output 2

No

He cannot move from Room $1$ to Room $2$.

到达一个洞穴,减去路程的价格,加上这里增加的价格,判断有没有时候价格小于等于0.
```cpp
#include
using namespace std;
const int N=1e5+5;
int n,m,x[N],y[N],a[N],p[N];
long long t;
int main()
{
scanf("%d%d%lld",&n,&m,&t);
for(int i=2;i<=n;i++)
scanf("%d",a+i);
for(int i=1;i<=m;i++)
scanf("%d%d",x+i,y+i),p[x[i]]+=y[i];
for(int i=1;i<=n;i++)
{
t-=a[i];
if(t<=0)
{
printf("No");
return 0;
}
t+=p[i];
}
printf("Yes");
return 0;
}
```

[ABC265B] Explore的更多相关文章

  1. Android配置----DDMS 连接真机(己ROOT),用file explore看不到data/data文件夹的解决办法

    Android DDMS 连接真机(己ROOT),用file explore看不到data/data文件夹,问题在于data文件夹没有权限,用360手机助手或豌豆荚也是看不见的. 有以下两种解决方法: ...

  2. android DDMS 连接真机(己ROOT),用file explore看不到data/data文件夹的解决办法

    android DDMS 连接真机(己ROOT),用file explore看不到data/data文件夹的解决办法 问题是没有权限,用360手机助手或豌豆荚也是看不见的. 简单的办法是用RE文件管理 ...

  3. HDU 5476 Explore Track of Point 数学平几

    Explore Track of Point Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem ...

  4. Ambari REST API 使用介绍 - How To: Use Swagger with Ambari (Explore Ambari REST)

    How To: Use Swagger with Ambari (Explore Ambari REST) Article Note : This feature is available from ...

  5. Android studio3.0打开Device File Explore(文件管理器)的方法(图文教程)

    Android studio3.0打开Device File Explore(文件管理器)的方法(图文教程) 看到网上AS3.0新增加的查看手机文件的新功能,全部都是转载的,没有几个人心细的把如何打开 ...

  6. Process Explore & Windbg

    遇到点内存泄漏.句柄泄漏,应该是家常便饭了.这次就是,程序运行内存一点点增加,句柄也是只增不减,个数竟然可以达到几十万,真是瞪大了我的双眼. 借此机会,学习下相关工具~ Process Explore ...

  7. explore your hadoop data and get real-time results

    deep api integration makes getting value from your big data easy 深度api集成使你大数据訪问更加easy Elasticsearch ...

  8. eclipse插件-easy explore

    最近找到一个Eclipse的插件,名字是Easy Explore,是Easy Structs 其 中的一个部分.主要的功能就是在Eclipse里面视图的部分如果看到自己的工程,或者Package,包什 ...

  9. eclipse中package explore和project explore 怎么相互切换???

    window--->show view--->other---->Java---->Package Explorer或者选project explore之后就可以相互切换了

  10. gitbook.explore更新升级了, 不能再搜索了

    www.gitbook.com/explore 不再是一个索引页面 Can I browse existing projects on GitBook ? The new version of Git ...

随机推荐

  1. Hugging News #0821: 新的里程碑:一百万个代码仓库!

    每一周,我们的同事都会向社区的成员们发布一些关于 Hugging Face 相关的更新,包括我们的产品和平台更新.社区活动.学习资源和内容更新.开源库和模型更新等,我们将其称之为「Hugging Ne ...

  2. 你能看到这个汉字么“  ” ?关于Unicode的私人使用区(PUA) 和浏览器端显示处理

    如果你现在使用的是chrome查看那么你是看不到我标题中的汉字的,显示为一个小方框,但是你使用edge查看的话,这个字就能正常的显示出来,不信你试试! 本故事源于我在做数据过程中遇到Unicode编码 ...

  3. DORA指标:公司业务成果的“占卜师”

    2009 年,受 John Allspaw 和 Paul Hammonds 在 Velocity 上演讲的启发,Patrick Debois 组织了一次名为"DevOps Days" ...

  4. Linux文件管理知识查找文件(第二篇)

    Linux文件管理知识:查找文件(第二篇) 上篇文章详细介绍了linux系统中查找文件的工具或者命令程序locate和find命令的基本操作.那么,今天这篇文章紧接着查找文件相关操作内容介绍. Fin ...

  5. 文心一言 VS 讯飞星火 VS chatgpt (86)-- 算法导论8.2 3题

    三.用go语言,假设我们在 COUNTING-SORT的第 10行循环的开始部分,将代码改写为: 10 for j = 1 to A.length 试证明该算法仍然是正确的.它还稳定吗? 文心一言: ...

  6. jQuery Ajax执行顺序问题

    代码如下: $(document).ready(function () { var res; $.ajax({ type: 'post', url: 'GridDemo.aspx/PlaceOrder ...

  7. CEMS大学生综合测评管理系统

    功能介绍 登录 首页 修改密码 提交申请 提交列表 数据可视化 审核列表 前端 components结构 搭建Vue项目 ​ Vue3快速上手: ​ https://cn.vuejs.org/guid ...

  8. 如何get一个终身免费续期的定制数字人?

    想拥有一个"数字分身" 吗?给你一个终身免费续期的特权. 定制周期长?训练.运营成本高?成片效果生硬?无法应用于实际场景? 随着AIGC技术的快速发展,虚拟数字人的生成效率不断提高 ...

  9. 「atcoder - 214G」Three Permutations

    la traduction. link. 如果我们对于每一个 \(k\in[0,n]\) 找到所有满足存在 \(k\) 个 \(i\) 使得 \(r_i=p_i\) 或 \(r_i=q_i\) 条件的 ...

  10. Azure Data Factory(九)基础知识回顾

    一,引言 在本文中,我们将继续了解什么是 Azure Data Factory,Azure Data Factory 的工作原理,Azure Data Factory 数据工程中的数据管道,并了解继承 ...