This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#define pb push_back
#define ll long long
#define ld long double
#define f first
#define s second
#define mp make_pair
const ll maxn = 1e6 + 5, maxm = 1e5 + 11, maxk = 6;
const ll inf = 1000000000, mod = inf + 7, mod2 = 998244353;
const ll pa = 31;
using namespace std;
ll m, n;
ll cost[maxn], cost2[maxn];
int main(){
ios_base::sync_with_stdio(false);
cin.tie(0), cout.tie(0);
cin >> m >> n;
for (int i = 1; i <= n + m - 1; ++i){
cin >> cost[i];
}
for (int i = 1; i <= n + m - 1; ++i){
cin >> cost2[i];
}
ll ans = 0;
for (int i = 1; i <= n + m - 1; ++i){
ans = ans + min(cost[i], cost2[i]);
}
cout << ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |