@w616561153
2020-06-28T06:24:12.000000Z
字数 359
阅读 526
#include <bits/stdc++.h>using namespace std;typedef long long ll;map<int, int> v1, v2;vector<int> pos;int main(){int n, a, b;scanf("%d%d%d", &n, &a, &b);for(int i = 0; i < a; i ++){int t1, t2;scanf("%d%d", &t1, &t2);v1[t1] = t2;pos.push_back(t1);}for(int i = 0; i < b; i ++){int t1, t2;scanf("%d%d", &t1, &t2);v2[t1] = t2;}ll ans = 0;for(int i = 0; i < a; i ++){int p = pos[i];ans += 1ll * v1[p] * v2[p];}cout << ans;return 0;}