#include <bits/stdc++.h>
using namespace std;
#define all(x) x.begin(), x.end()
#define vi vector<int>
#define vll vector<long long>
#define MOD 1000000007
#define endl '\n'
typedef long long ll;
void print(vi v){
cout<<"Contents of vector:\n";
for(auto x : v) cout<<x<<" ";
cout<<endl<<endl;
}
void solve(){
int m, n; cin>>m>>n;
int l[m+n-1], r[m+n-1];
for(int i = 0; i<m+n-1; i++) cin>>l[i];
for(int i = 0; i<m+n-1; i++) cin>>r[i];
if(m == 1){
ll ans = 0;
for(int i = 0; i<m+n-1; i++){
ans += min(l[i], r[m+n-1-i-1]);
}
cout<<ans<<endl;
return;
}
}
int main() {
ios_base::sync_with_stdio(false); cin.tie(nullptr);
//ifstream cin(""); ofstream cout("");///cia failai
//int T; cin>>T;
int T = 1;
for(int it = 1; it<=T; it++){
solve();
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
47 ms |
5348 KB |
Output is correct |
2 |
Correct |
51 ms |
5764 KB |
Output is correct |
3 |
Correct |
72 ms |
5752 KB |
Output is correct |
4 |
Correct |
54 ms |
6008 KB |
Output is correct |
5 |
Correct |
58 ms |
6136 KB |
Output is correct |
6 |
Correct |
48 ms |
5240 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
121 ms |
7032 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |