sacgajcvs

3rd que

Jul 19th, 2019
166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. /*
  2. _____ _ _ _ _
  3. |_ _| |__ ___ / \ _ __ ___| |__ _ _| |
  4. | | | '_ \ / _ \ / _ \ | '_ \/ __| '_ \| | | | |
  5. | | | | | | __// ___ \| | | \__ \ | | | |_| | |
  6. |_| |_| |_|\___/_/ \_\_| |_|___/_| |_|\__,_|_|
  7.  
  8. */
  9. #include<bits/stdc++.h>
  10. #define ll long long
  11. #define rep(i,a,b) for(ll int i=a;i<b;i++)
  12.  
  13. void solve()
  14. {
  15. ll n;
  16. cin>>n;
  17. ll a[n],b[n];
  18. ll ans=0;
  19. rep(i,0,n)
  20. {
  21. cin>>a[i];
  22. }
  23. rep(i,1,n)
  24. cin>>b[i];
  25. rep(i,1,n)
  26. {
  27. if(a[i]>a[i-1])
  28. ans+=b[i];
  29. }
  30. cout<<ans;
  31. return;
  32. }
  33. int main()
  34. {
  35. ios_base::sync_with_stdio(false);
  36. cin.tie(0);
  37. cout.tie(0);
  38. int TESTS=1;
  39. // cin>>TESTS;
  40. while(TESTS--)
  41. {
  42. solve();
  43. }
  44. time
  45. return 0;
  46. }
Advertisement
Add Comment
Please, Sign In to add comment