Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- #define ll long long
- #define _test int _TEST; cin>>_TEST; while(_TEST--)
- int main()
- {
- _test
- {
- ll int n;
- cin>>n;
- vector<ll int> a(n), b(n);
- for(auto &e: a) cin>>e;
- for(auto &e: b) cin>>e;
- ll int x = (*min_element(a.begin(), a.end()))*n +
- accumulate(b.begin(), b.end(), 0ll);
- ll int y = (*min_element(b.begin(), b.end()))*n +
- accumulate(a.begin(), a.end(), 0ll);
- cout<<min(x, y)<<"\n";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement