Jeremiah_

Repositórios - Neps

Apr 3rd, 2019
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.73 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2.  
  3. #define TAM 200010
  4. #define endl << '\n'
  5. #define SYNC ios::sync_with_stdio(0);
  6. #define $ << ' ' <<
  7.  
  8. using namespace std;
  9.  
  10. int main()
  11. {
  12.   SYNC
  13.  
  14.   map<int, int> net, comp, out;
  15.   int n, c;
  16.   cin >> c >> n;
  17.   int id, vs;
  18.   while (c--) {
  19.     cin >> id >> vs;
  20.     comp[id] = vs;
  21.   }
  22.   while (n--) {
  23.     cin >> id >> vs;
  24.     net[id] = max(net[id], vs);
  25.   }
  26.   for (auto a : net) {
  27.     if (comp.find(a.first) != comp.end()) {
  28.         if (comp[a.first] < a.second){
  29.             cout << a.first << ' ' << a.second << '\n';
  30.         }
  31.     } else {
  32.         cout << a.first $ a.second endl;
  33.     }
  34.   }
  35. //  for (auto a : out) {
  36. //    cout << a.first << ' ' << a.second << '\n';
  37. //  }
  38.  
  39.  
  40.   return 0;
  41. }
Advertisement
Add Comment
Please, Sign In to add comment