fork download
  1. #include <iostream>
  2. #include <vector>
  3. #include <algorithm>
  4. #include <queue>
  5. #include <map>
  6. #include <set>
  7. #include <bits/stdc++.h>
  8. using namespace std;
  9. #include <ext/pb_ds/assoc_container.hpp>
  10. using namespace __gnu_pbds;
  11. template <class T>
  12. using orderStaticTree =
  13. tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
  14.  
  15. #define ll long long
  16.  
  17. #define saleh \
  18.   ios_base::sync_with_stdio(false); \
  19.   cin.tie(nullptr);
  20.  
  21. const int md = 1e9 + 7;
  22.  
  23. int main()
  24. {
  25. saleh;
  26. int t;
  27. cin >> t;
  28. while (t--)
  29. {
  30. int n, m, l, r;
  31. cin >> n >> m >> l >> r;
  32. int lf = 0, rr = 0;
  33. while (m--)
  34. {
  35. if (lf > l)
  36. lf--;
  37. else
  38. rr++;
  39. }
  40. cout << lf << " " << rr << endl;
  41. }
  42.  
  43. return 0;
  44. }
Success #stdin #stdout 0.01s 5288KB
stdin
Standard input is empty
stdout
Standard output is empty