My issue
plz help me to understand why we r using the formula c=r-c+l??
My code
#include <bits/stdc++.h>
using namespace std;
int main() {
// your code goes here
int t;
cin>>t;
while(t--)
{
int n,c,q;
cin>>n>>c>>q;
int l,r;
for(int j=0;j<q;j++)
{
cin>>l>>r;
if(c>=l&&c<=r)
{
c=r-c+l;
}
}
cout<<c<<endl;
}
return 0;
}
Problem Link: TAVISUAL Problem - CodeChef