結果

問題 No.1795 AtCoder Heuristic Rating coloring
ユーザー yorry2101yorry2101
提出日時 2023-09-15 16:37:11
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 338 ms / 2,000 ms
コード長 596 bytes
コンパイル時間 1,003 ms
コンパイル使用メモリ 88,032 KB
実行使用メモリ 14,344 KB
最終ジャッジ日時 2023-09-15 16:37:25
合計ジャッジ時間 13,486 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 7 ms
4,376 KB
testcase_05 AC 7 ms
4,384 KB
testcase_06 AC 7 ms
4,380 KB
testcase_07 AC 8 ms
4,380 KB
testcase_08 AC 7 ms
4,380 KB
testcase_09 AC 9 ms
4,380 KB
testcase_10 AC 8 ms
4,380 KB
testcase_11 AC 7 ms
4,380 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 AC 2 ms
4,380 KB
testcase_14 AC 2 ms
4,376 KB
testcase_15 AC 2 ms
4,376 KB
testcase_16 AC 2 ms
4,380 KB
testcase_17 AC 2 ms
4,376 KB
testcase_18 AC 2 ms
4,376 KB
testcase_19 AC 1 ms
4,384 KB
testcase_20 AC 2 ms
4,380 KB
testcase_21 AC 2 ms
4,376 KB
testcase_22 AC 2 ms
4,380 KB
testcase_23 AC 2 ms
4,380 KB
testcase_24 AC 2 ms
4,376 KB
testcase_25 AC 2 ms
4,380 KB
testcase_26 AC 2 ms
4,380 KB
testcase_27 AC 1 ms
4,380 KB
testcase_28 AC 2 ms
4,380 KB
testcase_29 AC 2 ms
4,380 KB
testcase_30 AC 2 ms
4,380 KB
testcase_31 AC 2 ms
4,380 KB
testcase_32 AC 126 ms
6,544 KB
testcase_33 AC 84 ms
5,712 KB
testcase_34 AC 182 ms
7,664 KB
testcase_35 AC 159 ms
6,912 KB
testcase_36 AC 180 ms
7,828 KB
testcase_37 AC 100 ms
6,076 KB
testcase_38 AC 101 ms
6,016 KB
testcase_39 AC 202 ms
7,732 KB
testcase_40 AC 131 ms
6,564 KB
testcase_41 AC 185 ms
7,404 KB
testcase_42 AC 114 ms
6,320 KB
testcase_43 AC 123 ms
6,704 KB
testcase_44 AC 158 ms
7,412 KB
testcase_45 AC 118 ms
6,292 KB
testcase_46 AC 210 ms
7,960 KB
testcase_47 AC 52 ms
4,704 KB
testcase_48 AC 125 ms
6,500 KB
testcase_49 AC 229 ms
8,128 KB
testcase_50 AC 110 ms
5,976 KB
testcase_51 AC 98 ms
5,816 KB
testcase_52 AC 252 ms
10,420 KB
testcase_53 AC 254 ms
10,480 KB
testcase_54 AC 323 ms
14,344 KB
testcase_55 AC 338 ms
14,240 KB
testcase_56 AC 321 ms
14,276 KB
testcase_57 AC 327 ms
14,280 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <utility>
#include <map>
using namespace std;
int main(void){
    int n, m;
    cin >> n >> m;
    map<string, int> r;
    string s;
    int point;
    for (int i = 0; i < n; i++) {
        cin >> s >> point;
        r.insert(make_pair(s, point));
    }
    for (int i = 0; i < m; i++) {
        cin >> s >> point;
        if (r.find(s) != r.end()) {
            if (r[s] < point) r[s] = point;
        }
        else r.insert(make_pair(s, point));
    }
    for (auto i = r.begin(); i != r.end(); i++) {
        cout << i->first << " " << i->second << endl;
    }
}
0