-
Notifications
You must be signed in to change notification settings - Fork 0
/
138_B. Death's Blessing.cpp
58 lines (50 loc) · 1.09 KB
/
138_B. Death's Blessing.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define ss string
#define nn "\n"
#define nl "\n"
#define yes cout<<"YES"<<nn
#define no cout<<"NO"<<nn
#define MOD 1000000007
#define pll pair<ll,ll>
#define For(i,x,n) for(ll i=x;i<n;i++)
#define IN1(x); ll x;cin>>x;
#define IN2(x,y); ll x,y;cin>>x>>y;
#define IN3(x,y,z); ll x,y,z;cin>>x>>y>>z;
#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define printclock cerr<<"Time : "<<1000*(ld)clock()/(ld)CLOCKS_PER_SEC<<"ms\n";
void solve()
{
IN1(n);
ll x,sum=0;
for(ll i = 0;i<n;i++){
cin>>x;
sum += x;
}
ll mx = INT_MIN;
for(ll i = 0;i<n;i++){
cin>>x;
sum += x;
if(x>mx) mx = x;
}
cout<<sum-mx<<nl;
}
int main ()
{
fastio;
#ifndef ONLINE_JUDGE
//freopen ( "input.txt", "r", stdin );
//freopen ( "output.txt", "w", stdout );
#endif
ll t = 1;
cin >> t;
while(t--)
{
solve();
}
printclock
cout.flush();
return 0;
}