Advertisement
isaf27

Global Round 7, solution of the problem B

Mar 19th, 2020
6,414
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.86 KB | None | 0 0
  1. #include <cmath>
  2. #include <iostream>
  3. #include <vector>
  4. #include <algorithm>
  5. #include <string>
  6. #include <set>
  7. #include <map>
  8. #include <list>
  9. #include <time.h>
  10. #include <math.h>
  11. #include <random>
  12. #include <deque>
  13. #include <queue>
  14. #include <cassert>
  15. #include <unordered_map>
  16. #include <unordered_set>
  17. #include <iomanip>
  18. #include <bitset>
  19. #include <sstream>
  20. #include <chrono>
  21. #include <cstring>
  22.  
  23. using namespace std;
  24.  
  25. typedef long long ll;
  26.  
  27. #ifdef iq
  28.   mt19937 rnd(228);
  29. #else
  30.   mt19937 rnd(chrono::high_resolution_clock::now().time_since_epoch().count());
  31. #endif
  32.  
  33. int main() {
  34. #ifdef iq
  35.   freopen("a.in", "r", stdin);
  36. #endif
  37.   ios::sync_with_stdio(0);
  38.   cin.tie(0);
  39.   int n;
  40.   cin >> n;
  41.   vector <int> a(n);
  42.   int x = 0;
  43.   for (int i = 0; i < n; i++) {
  44.     cin >> a[i];
  45.     a[i] += x;
  46.     x = max(x, a[i]);
  47.     cout << a[i] << ' ';
  48.   }
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement