結果
| 問題 | No.1795 AtCoder Heuristic Rating coloring | 
| コンテスト | |
| ユーザー |  Kome_soudou | 
| 提出日時 | 2021-12-24 01:28:58 | 
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 309 ms / 2,000 ms | 
| コード長 | 393 bytes | 
| コンパイル時間 | 1,596 ms | 
| コンパイル使用メモリ | 177,860 KB | 
| 実行使用メモリ | 14,464 KB | 
| 最終ジャッジ日時 | 2024-09-20 03:18:05 | 
| 合計ジャッジ時間 | 8,659 ms | 
| ジャッジサーバーID (参考情報) | judge3 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 4 | 
| other | AC * 54 | 
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main()
{
  int N, M;
  cin >> N >> M;
  string S, T;
  int A, B;
  map<string, int> m;
  for(int i = 0; i < N; i++)
  {
    cin >> S >> A;
    m[S] = A;
  }
  for(int j = 0; j < M; j++)
  {
    cin >> T >> B;
    if(m.count(T)) m.at(T) = B;
    else m[T] = B;
  }
  
  for(auto p : m) cout << p.first << ' ' << p.second << endl;
  return 0;
}
            
            
            
        