Untitled

 avatar
user_5668965
c_cpp
5 days ago
284 B
1
Indexable
Never
#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;
}
	  				       				  	 			
Leave a Comment