Advertisement
amine99

Untitled

Apr 4th, 2018
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.85 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. #define _ ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
  5. #define itloop(it,x) for(auto it=x.begin();it!=x.end();it++)
  6. #define reloop(i,e,b) for(auto i=e;i>=b;i--)
  7. #define loop(i,b,e) for(auto i=b;i<=e;i++)
  8. #define ALL(x) x.begin(),x.end()
  9. #define SZ(x) x.size()
  10. #define PB push_back
  11. #define MP make_pair
  12. #define F first
  13. #define S second
  14. typedef long long LL;
  15. typedef vector<int> VI;
  16.  
  17. const int N=1e5+1;
  18. int n,k,t[N],wake[N],acc[N],ans,last;
  19.  
  20. int main()
  21. {_
  22.    cin >> n >> k;
  23.    loop(i,0,n-1)
  24.       cin >> t[i];
  25.    loop(i,0,n-1)
  26.       cin >> wake[i];
  27.    if(!wake[0]) {
  28.       acc[0] = t[0];
  29.       last = t[0];
  30.    }
  31.    loop(i,1,n-1) {
  32.       if(!wake[i]) {
  33.          acc[i] = t[i] + last;
  34.          last = acc[i];
  35.       }
  36.    }
  37.    loop(i,0,n-1) {
  38.       cout << acc[i] << " ";
  39.    }
  40.  
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement