Submission #1348029

#TimeUsernameProblemLanguageResultExecution timeMemory
1348029almaarmudTrain Or Bus (NOI25_trainorbus)C++20
100 / 100
0 ms344 KiB
/*
██████╗  █████╗ ███████╗██╗  ██╗██╗██████╗
██╔══██╗██╔══██╗██╔════╝██║  ██║██║██╔══██╗
██████╔╝███████║███████╗███████║██║██║   ██║
██╔══██╗██╔══██║╚════██║██╔══██║██║██║   ██║
██║  ██║██║  ██║███████║██║  ██║██║██████╔╝
╚═╝  ╚═╝╚═╝  ╚═╝╚══════╝╚═╝  ╚═╝╚═╝╚═════╝
*/
#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ll long long
#define ull unsigned long long
#define ld long double
#define str string
#define ch char
#define db double
#define pb push_back
#define ff first
#define ss second
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define YES cout<<"YES\n";
#define NO cout<<"NO\n";
#define Bob cout<<"Bob\n";
#define Alice cout<<"Alice\n";
#define ordered_set tree<pair<ll, ll>, null_type,less<pair<ll,ll>>,rb_tree_tag,tree_order_statistics_node_update>
const ll MOD=1e9+7;
const ll INF = 10000000000;
void solve(){
    ll n;
    cin>>n;
    vector<ll>a(n+1),b(n+1);
    for(int i = 1;i<=n;i++)cin>>a[i];
    for(int i = 1;i<=n;i++)cin>>b[i];
    vector<ll>dp(n+1,0);
    dp[0]=0;
    for(int i = 1;i<=n;i++){
      dp[i]=dp[i-1]+min(a[i],b[i]);
    }
    cout<<dp[n];
}
signed main(){
    ll t=1;
    //cin>>t;
    while(t--){
        solve();
    }
    return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...