Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- _____ _ _ _ _
- |_ _| |__ ___ / \ _ __ ___| |__ _ _| |
- | | | '_ \ / _ \ / _ \ | '_ \/ __| '_ \| | | | |
- | | | | | | __// ___ \| | | \__ \ | | | |_| | |
- |_| |_| |_|\___/_/ \_\_| |_|___/_| |_|\__,_|_|
- */
- #include<bits/stdc++.h>
- #define ll long long
- #define rep(i,a,b) for(ll int i=a;i<b;i++)
- void solve()
- {
- ll n;
- cin>>n;
- ll a[n],b[n];
- ll ans=0;
- rep(i,0,n)
- {
- cin>>a[i];
- }
- rep(i,1,n)
- cin>>b[i];
- rep(i,1,n)
- {
- if(a[i]>a[i-1])
- ans+=b[i];
- }
- cout<<ans;
- return;
- }
- int main()
- {
- ios_base::sync_with_stdio(false);
- cin.tie(0);
- cout.tie(0);
- int TESTS=1;
- // cin>>TESTS;
- while(TESTS--)
- {
- solve();
- }
- time
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment