题解:CF2094B Bobritto Bandito

· · 题解

考虑先往左边感染,知道感染完或感染到不能再感染,在往右边感染就可以了。

#include<bits/stdc++.h>
using namespace std;
int t,n,m,l,r,ll,rr;
int main()
{
    cin>>t;
    while(t--)
    {
        ll=0,rr=0;
        cin>>n>>m>>l>>r;
        int len=r-l+1;
        ll-=min(-l,m);
        m+=ll;
        rr+=m;
        cout<<ll<<" "<<rr<<"\n";
    }
    return 0;;
}