fork download
  1. /* ___________________________________________ */
  2.  
  3. #include <bits/stdc++.h>
  4.  
  5. using namespace std;
  6. #define int long long
  7. #define fi first
  8. #define se second
  9. #define pushb push_back
  10. #define SZ(v) (int)v.size()
  11. #define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
  12. #define debug cout << "NO ERROR"; exit(0);
  13. #define endl "\n"
  14. #define mapa(x, y) make_pair(x, y)
  15. #define double long double
  16. #define lb lower_bound
  17. #define ub upper_bound
  18. #define pii pair<int, int>
  19. #define ALL(v) v.begin(), v.end()
  20. #define BIT(x, i) (((x) >> (i)) & 1)
  21.  
  22. template<class X, class Y>
  23. bool minimize(X &x, const Y &y) {
  24. if (x > y) {
  25. x = y;
  26. return true;
  27. }
  28. return false;
  29. }
  30.  
  31. template<class X, class Y>
  32. bool maximize(X &x, const Y &y) {
  33. if (x < y) {
  34. x = y;
  35. return true;
  36. }
  37. return false;
  38. }
  39.  
  40. int lcm(int x, int y){
  41. return x / __gcd(x, y) * y;
  42. }
  43.  
  44. const int INF = 1e18;
  45. const double pi = acos(-1);
  46. const int MOD = 1e9 + 7;
  47. const int LimN = 1e6 + 5;
  48. const int LimM = 1e5 + 5;
  49. const double dist = 0.000001;
  50. const int ADD = 96e3;
  51.  
  52. const int d4x[4] = {-1, 1, 0, 0};
  53. const int d4y[4] = {0, 0, 1, -1};
  54.  
  55. void solve() {
  56.  
  57. // code here
  58.  
  59. }
  60.  
  61. /* Authors: nguyen Hai Duong from le Do secondary school Da nang */
  62.  
  63. signed main() {
  64. #ifndef ONLINE_JUDGE
  65. freopen("ab.inp", "r", stdin);
  66. freopen("ab.out", "w", stdout);
  67. #else
  68. // freopen("task.inp", "r", stdin);
  69. // freopen("task.out", "w", stdout);
  70. #endif
  71.  
  72. fast;
  73.  
  74. int numtest = 1;
  75. // cin >> numtest;
  76.  
  77. while (numtest--) {
  78. solve();
  79. }
  80.  
  81. return 0;
  82. }
  83.  
  84. // THIS IS DUONG's TEMPLATE &&09042012&&
  85.  
  86.  
  87.  
  88. class SegmentTree {
  89.  
  90. private:
  91. int n;
  92. vector<int> v;
  93. const int INF = 1e9;
  94.  
  95. void update(int id, int l, int r, int pos, int val) {
  96. if (pos < l || pos > r) return;
  97.  
  98. if (l == r) {
  99. v[id] = val;
  100. return;
  101. }
  102.  
  103. int mid = (l + r) / 2;
  104.  
  105. update(id * 2, l, mid, pos, val);
  106. update(id * 2 + 1, mid + 1, r, pos, val);
  107.  
  108. v[id] = min(v[id * 2], v[id * 2 + 1]);
  109. }
  110.  
  111. int get(int id, int l, int r, int sta, int fin) {
  112. if (fin < l || r < sta) return INF;
  113.  
  114. if (sta <= l && r <= fin) {
  115. return v[id];
  116. }
  117.  
  118. int mid = (l + r) / 2;
  119.  
  120. return min(
  121. get(id * 2, l, mid, sta, fin),
  122. get(id * 2 + 1, mid + 1, r, sta, fin)
  123. );
  124. }
  125.  
  126. public:
  127. SegmentTree(int _n) {
  128. n = _n;
  129. v.assign(n * 5 + 5, INF);
  130. }
  131.  
  132. void update(int pos, int val) {
  133. update(1, 1, n, pos, val);
  134. }
  135.  
  136. int get(int sta, int fin) {
  137. if (sta > fin) return INF;
  138. return get(1, 1, n, sta, fin);
  139. }
  140. };
Success #stdin #stdout 0.01s 5288KB
stdin
Standard input is empty
stdout
Standard output is empty