結果

問題 No.1795 AtCoder Heuristic Rating coloring
ユーザー ygd.ygd.
提出日時 2022-01-05 00:01:30
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 379 ms / 2,000 ms
コード長 1,085 bytes
コンパイル時間 2,912 ms
コンパイル使用メモリ 213,184 KB
実行使用メモリ 20,876 KB
最終ジャッジ日時 2024-04-23 03:31:25
合計ジャッジ時間 10,998 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,812 KB
testcase_01 AC 2 ms
6,944 KB
testcase_02 AC 2 ms
6,940 KB
testcase_03 AC 2 ms
6,940 KB
testcase_04 AC 7 ms
6,940 KB
testcase_05 AC 7 ms
6,940 KB
testcase_06 AC 9 ms
6,940 KB
testcase_07 AC 8 ms
6,940 KB
testcase_08 AC 8 ms
6,940 KB
testcase_09 AC 10 ms
6,940 KB
testcase_10 AC 10 ms
6,944 KB
testcase_11 AC 9 ms
6,940 KB
testcase_12 AC 2 ms
6,944 KB
testcase_13 AC 2 ms
6,940 KB
testcase_14 AC 2 ms
6,940 KB
testcase_15 AC 2 ms
6,940 KB
testcase_16 AC 2 ms
6,944 KB
testcase_17 AC 2 ms
6,940 KB
testcase_18 AC 2 ms
6,940 KB
testcase_19 AC 2 ms
6,940 KB
testcase_20 AC 2 ms
6,940 KB
testcase_21 AC 2 ms
6,940 KB
testcase_22 AC 2 ms
6,944 KB
testcase_23 AC 2 ms
6,940 KB
testcase_24 AC 2 ms
6,940 KB
testcase_25 AC 2 ms
6,940 KB
testcase_26 AC 2 ms
6,940 KB
testcase_27 AC 2 ms
6,940 KB
testcase_28 AC 2 ms
6,944 KB
testcase_29 AC 2 ms
6,944 KB
testcase_30 AC 2 ms
6,940 KB
testcase_31 AC 2 ms
6,940 KB
testcase_32 AC 131 ms
8,408 KB
testcase_33 AC 91 ms
6,944 KB
testcase_34 AC 186 ms
9,652 KB
testcase_35 AC 162 ms
9,012 KB
testcase_36 AC 187 ms
9,964 KB
testcase_37 AC 101 ms
7,120 KB
testcase_38 AC 104 ms
8,284 KB
testcase_39 AC 199 ms
9,956 KB
testcase_40 AC 138 ms
8,848 KB
testcase_41 AC 186 ms
9,548 KB
testcase_42 AC 123 ms
8,560 KB
testcase_43 AC 134 ms
8,984 KB
testcase_44 AC 165 ms
9,580 KB
testcase_45 AC 127 ms
8,712 KB
testcase_46 AC 210 ms
10,112 KB
testcase_47 AC 54 ms
6,940 KB
testcase_48 AC 122 ms
8,776 KB
testcase_49 AC 217 ms
10,320 KB
testcase_50 AC 112 ms
7,188 KB
testcase_51 AC 100 ms
7,024 KB
testcase_52 AC 273 ms
14,500 KB
testcase_53 AC 274 ms
14,376 KB
testcase_54 AC 377 ms
20,752 KB
testcase_55 AC 379 ms
20,748 KB
testcase_56 AC 376 ms
20,876 KB
testcase_57 AC 365 ms
20,748 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(a) (a).begin(),(a).end() //lower_bound(ALL(a),x)
using ll = long long;
using P = pair<int,int>;
using VI = vector<int>;
using VVI = vector<vector<int>>;
template <typename T>
bool chmax(T &a, const T& b) {
  if (a < b) {
    a = b;  // aをbで更新
    return true;
  }
  return false;
}
template <typename T>
bool chmin(T &a, const T& b) {
  if (a > b) {
    a = b;  // aをbで更新
    return true;
  }
  return false;
}
int INF = 100100100;

int main() {
    int n,m;
    cin >> n >> m;
    map<string, int> rating;
    rep(i,n) {
        string name;
        int r;
        cin >> name >> r;
        rating[name] = r;
    }
    rep(i,m) {
        string name;
        int nr;
        cin >> name >> nr;
        rating[name] = nr;
    }
    vector<string> ret;
    for (auto i = rating.begin(); i != rating.end(); i++) {
        ret.push_back(i -> first);
    }
    sort(ALL(ret));
    for (auto ans: ret) {
        cout << ans << " " << rating[ans] << endl;
    }
}
0