Advertisement
Guest User

Untitled

a guest
Sep 20th, 2014
189
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.03 KB | None | 0 0
  1. /*
  2. Author: Golam Rahman Tushar
  3. ........Aust Cse 27th batch.........
  4. */
  5.  
  6. //{ Template
  7.  
  8. //{ C-headers
  9. #include <cstdio>
  10. #include <cstdlib>
  11. #include <cmath>
  12. #include <cstring>
  13. #include <climits>
  14. #include <cfloat>
  15. #include <cctype>
  16. #include <cassert>
  17. #include <ctime>
  18. //}
  19. //{ C++-headers
  20. #include <iostream>
  21. #include <iomanip>
  22. #include <sstream>
  23. #include <algorithm>
  24. #include <utility>
  25. #include <string>
  26. #include <stack>
  27. #include <queue>
  28. #include <vector>
  29. #include <set>
  30. #include <map>
  31.  
  32. using namespace std;
  33. //}
  34.  
  35. //}
  36. //{ Floating-points
  37. #define EPS DBL_EPSILON
  38. #define abs(x) (((x) < 0) ? - (x) : (x))
  39. #define zero(x) (abs (x) < EPS)
  40. #define equal(a,b) (zero ((a) - (b)))
  41. #define PI 2 * acos (0.0)
  42. //}
  43.  
  44. #define INF 1<<29
  45. #define ll long long
  46.  
  47. template <typename T>
  48. std::string to_string(T const& value) {
  49. stringstream sstr;
  50. sstr << value;
  51. return sstr.str();
  52. }
  53. //}
  54.  
  55. template <class T> T gcd(T a,T b){if(b==0) return a;else return gcd(b,a%b);}
  56. template <class T> T lcm(T a,T b){return (a*b)/gcd(a,b);}
  57. template <class T> T power( T a, T b){if(b==0) return 1; T x=a;for(T i=2;i<=b;i++) a=a*x;return a;}
  58. template <class T> T BigMod(T a,T b,T c){if(a==0) return 0;if(b==0) return 1;if(b%2==0){T x=BigMod(a,b/2,c)%c;return (x*x)%c;}else return ((a%c)*BigMod(a,b-1,c)%c)%c;}
  59.  
  60. int a[57], b[57], c[57], d[57];
  61. int main ()
  62. {
  63. //freopen("input.txt","r",stdin);
  64. int p, q, l, r;
  65. while(cin>>p>>q>>l>>r) {
  66. int i , j, k;
  67. for(i=0;i<p;i++) {
  68. cin>>a[i]>>b[i];
  69. }
  70. for(i=0;i<q;i++) {
  71. cin>>c[i]>>d[i];
  72. }
  73. int cnt= 0;
  74.  
  75. for(i=l;i<=r;i++) {
  76. bool flag = true;
  77. for(j=0;j<q&&flag;j++) {
  78. for(k=0;k<p&&flag;k++)
  79. if(((c[j]+i)>=a[k]&&(c[j]+i)<=b[k])||((d[j]+i)>=a[k]&&(d[j]+i)<=b[k])) {
  80. flag = false; cnt++;
  81. cout<<i<<endl;
  82. }
  83. }
  84. }
  85.  
  86. cout<<cnt<<endl;
  87. }
  88. return 0;
  89. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement