結果

問題 No.1795 AtCoder Heuristic Rating coloring
ユーザー harurunharurun
提出日時 2021-11-15 00:20:54
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 384 ms / 2,000 ms
コード長 551 bytes
コンパイル時間 2,786 ms
コンパイル使用メモリ 225,924 KB
実行使用メモリ 22,152 KB
最終ジャッジ日時 2023-10-20 07:37:41
合計ジャッジ時間 10,800 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 7 ms
4,348 KB
testcase_05 AC 7 ms
4,348 KB
testcase_06 AC 8 ms
4,348 KB
testcase_07 AC 8 ms
4,348 KB
testcase_08 AC 8 ms
4,348 KB
testcase_09 AC 9 ms
4,348 KB
testcase_10 AC 10 ms
4,348 KB
testcase_11 AC 9 ms
4,348 KB
testcase_12 AC 2 ms
4,348 KB
testcase_13 AC 2 ms
4,348 KB
testcase_14 AC 2 ms
4,348 KB
testcase_15 AC 2 ms
4,348 KB
testcase_16 AC 3 ms
4,348 KB
testcase_17 AC 2 ms
4,348 KB
testcase_18 AC 2 ms
4,348 KB
testcase_19 AC 2 ms
4,348 KB
testcase_20 AC 2 ms
4,348 KB
testcase_21 AC 2 ms
4,348 KB
testcase_22 AC 2 ms
4,348 KB
testcase_23 AC 2 ms
4,348 KB
testcase_24 AC 3 ms
4,348 KB
testcase_25 AC 2 ms
4,348 KB
testcase_26 AC 2 ms
4,348 KB
testcase_27 AC 2 ms
4,348 KB
testcase_28 AC 2 ms
4,348 KB
testcase_29 AC 3 ms
4,348 KB
testcase_30 AC 2 ms
4,348 KB
testcase_31 AC 2 ms
4,348 KB
testcase_32 AC 131 ms
9,072 KB
testcase_33 AC 89 ms
7,120 KB
testcase_34 AC 191 ms
10,184 KB
testcase_35 AC 169 ms
9,676 KB
testcase_36 AC 191 ms
10,508 KB
testcase_37 AC 103 ms
7,364 KB
testcase_38 AC 109 ms
8,832 KB
testcase_39 AC 207 ms
10,512 KB
testcase_40 AC 142 ms
9,376 KB
testcase_41 AC 195 ms
10,216 KB
testcase_42 AC 122 ms
9,100 KB
testcase_43 AC 133 ms
9,516 KB
testcase_44 AC 171 ms
10,248 KB
testcase_45 AC 126 ms
9,116 KB
testcase_46 AC 217 ms
10,776 KB
testcase_47 AC 56 ms
6,152 KB
testcase_48 AC 130 ms
9,312 KB
testcase_49 AC 226 ms
10,864 KB
testcase_50 AC 116 ms
7,424 KB
testcase_51 AC 103 ms
7,260 KB
testcase_52 AC 300 ms
15,044 KB
testcase_53 AC 286 ms
15,016 KB
testcase_54 AC 383 ms
22,152 KB
testcase_55 AC 384 ms
22,152 KB
testcase_56 AC 383 ms
22,152 KB
testcase_57 AC 382 ms
22,152 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main(){
  int N,M;
  cin>>N>>M;
  map<string,int> um;
  for(int i=0;i<N;i++){
    string S;
    int A;
    cin>>S>>A;
    um.insert(make_pair(S,A));
  }
  for(int i=0;i<M;i++){
    string T;
    int B;
    cin>>T>>B;
    if(um.find(T)==um.end()){
      um.insert(make_pair(T,B));
    }else{
      um[T]=B;
    }
  }
  vector<pair<string,int>> ans;
  for(auto i:um){
    ans.push_back(i);
  }
  sort(ans.begin(),ans.end());
  for(auto i:ans){
    cout<<i.first<<" "<<i.second<<endl;
  }
  return 0;
}
0