1 solutions

  • 0
    @ 2025-5-26 18:02:15
    #include<bits/stdc++.h>
    using namespace std;
    typedef long long LL;
    const int N=1e5+10;
    LL b[N],a[N];
    int main()
    {
    	LL n,m,t;
    	cin>>n>>m>>t;
    	for(int i=1;i<n;i++)
    	{
    		cin>>a[i];
    	
    	}
    	while(m--)
    	{
    		LL x,y;
    		cin>>x>>y;
    		b[x]=y;
    	}
    	bool st=true;
    	for(int i=1;i<=n;i++)
    	{
    	//	cout<<t<<" "<<a[i]<<endl;
    		if(t>a[i]) //可以跳过去 
    		{
    			t-=a[i]; //减少时间 
    			t+=b[i+1]; //增加时间 
    		}
    		else //跳不过去 
    		{
    			st=false;
    		}
    		
    	}
    	if(st) cout<<"Yes";
    	else cout<<"No";
    	return 0;
    }
    
    
    • 1

    Information

    ID
    2382
    Time
    1000ms
    Memory
    256MiB
    Difficulty
    3
    Tags
    (None)
    # Submissions
    11
    Accepted
    3
    Uploaded By