SHARE
TWEET

B

tsypko Jun 2nd, 2020 635 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main() {
  5.     long long l1, r1, l2, r2, k;
  6.     cin >> l1 >> r1 >> l2 >> r2 >> k;
  7.     long long l = max(l1, l2);
  8.     long long r = min(r1, r2);
  9.     long long ans = max(0LL, r - l + 1);
  10.     if (l <= k && k <= r)
  11.         ans--;
  12.     cout << ans << endl;
  13. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top