Untitled
user_5668965
c_cpp
a year ago
284 B
11
Indexable
#include<bits/stdc++.h>
using namespace std;
uint64_t n,i,a,b;
map<int,int> m;
int main() {
for(cin >> n;n--;)
cin >> a >> b, m[a]=b;
for(cin >> n;n--;)
cin >> a >> b, m[a]<b?m[a]=b:0;
a=0;
for(auto e:m)
a+=e.second;
cout << a;
}
Editor is loading...
Leave a Comment