#include <iostream>
#include <map>
using namespace std;
typedef long long LL;
map <int, int> mp;
int main()
{
ios::sync_with_stdio(false);
int n, a, b, index, value;
LL ans = 0;
cin >> n >> a >> b;
while(a --)
{
cin >> index >> value;
mp[index] = value;
}
while(b --)
{
cin >> index >> value;
if(mp[index] != 0)
{
ans += (LL)mp[index] * (LL)value;
}
}
cout << ans << endl;
return 0;
}
参考博客:https://blog.csdn.net/qq_38632614/article/details/107736600
本文地址:https://blog.csdn.net/weixin_43832005/article/details/108127614