Advertisement
Guest User

Untitled

a guest
Oct 14th, 2019
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.52 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. #include <vector>
  4. #include <cmath>
  5. #include <queue>
  6. #include <stack>
  7. #include <algorithm>
  8. #include <map>
  9. #include <iomanip>
  10. #include <set>
  11. #include <tuple>
  12. #include <unordered_set>
  13. #include <ctime>
  14. #include <cstdlib>
  15.  
  16. using namespace std;
  17.  
  18. #define int long long
  19.  
  20. #define HOME
  21.  
  22. const int N = 1e6 + 7;
  23. const int INF = 1e9;
  24.  
  25. int n, m;
  26. int k, p;
  27.  
  28. vector<int> a;
  29. vector<int> b;
  30.  
  31. vector<int> buffa;
  32. vector<int> buffi;
  33.  
  34. void init() {
  35.     for (int i = 0; i < n; i++) {
  36.         b[i/p] += a[i];
  37.     }
  38. }
  39.  
  40. // Доделать сумму i - 1; j - 1
  41. int rsq(int i, int j) {
  42.     int ans = 0;
  43.     while (i % p != 0 && i <= r) {
  44.         ans += a[i];
  45.         i++;
  46.     }
  47.     while (j % p != p - 1 && j >= i) {
  48.         ans ++ a[j];
  49.         j--;
  50.     }
  51.  
  52.     for (int t = i / k; t < (i / k) + ((j - i + 1) / 2); t++) {
  53.         ans += b[t];
  54.     }
  55.  
  56.     return ans;
  57. }
  58.  
  59. void upd(int i, int e) {
  60.     buffi.push_back(i);
  61.     buffa.push_back(e);
  62.  
  63.     if (buffi.size() * buffi.size() == n) {
  64.         i
  65.     }
  66. }
  67.  
  68. void solve() {
  69.     char op;
  70.     int i, e;
  71.     cin >> op >> i >> e;
  72. }
  73.  
  74. signed main() {
  75.  
  76.     ios_base::sync_with_stdio(false);
  77.     cin.tie(0);
  78.  
  79. #ifdef HOME
  80.     freopen("in.txt", "r", stdin);
  81.     freopen("out.txt", "w", stdout);
  82. #endif
  83.  
  84.     cin >> n >> m;
  85.     a.resize(n);
  86.     for (int i = 0; i < n; i++) {
  87.         cin >> a[i];
  88.     }
  89.  
  90.     k = int(sqrt(n))
  91.     p = n / k;
  92.     b.resize(k + 1);
  93.  
  94.     while (m--) {
  95.         solve();
  96.     }
  97.  
  98. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement