2 条题解

  • 4
    @ 2025-11-3 17:27:16
    #include <bits/stdc++.h>
    using namespace std;
    typedef long long ll;
    const ll N=1e6+5;
    void solve(){
        ll n,T;cin>>n>>T;
        ll x=0;
        while(n--){
            ll t,k;cin>>t>>k;
            if(k>=x-T+t){
                x+=t;
                continue;
            }        
            if(k>=x-T) x=T+k+1;
            else x++;
        }
        cout<<x<<'\n';
    }
    int main(){
        ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
        ll _=1;
    //    cin>>_;
        while(_--){
            solve();
        }
        return 0;
    }
    

    信息

    ID
    1168
    时间
    1000ms
    内存
    256MiB
    难度
    7
    标签
    递交数
    214
    已通过
    51
    上传者