結果

問題 No.1795 AtCoder Heuristic Rating coloring
ユーザー ygd.ygd.
提出日時 2022-01-05 00:00:52
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 605 ms / 2,000 ms
コード長 1,136 bytes
コンパイル時間 5,167 ms
コンパイル使用メモリ 275,020 KB
実行使用メモリ 21,516 KB
最終ジャッジ日時 2024-04-23 03:30:57
合計ジャッジ時間 16,207 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,812 KB
testcase_01 AC 2 ms
6,944 KB
testcase_02 AC 1 ms
6,940 KB
testcase_03 AC 2 ms
6,944 KB
testcase_04 AC 9 ms
6,944 KB
testcase_05 AC 9 ms
6,940 KB
testcase_06 AC 10 ms
6,940 KB
testcase_07 AC 11 ms
6,940 KB
testcase_08 AC 11 ms
6,944 KB
testcase_09 AC 13 ms
6,940 KB
testcase_10 AC 13 ms
6,944 KB
testcase_11 AC 12 ms
6,944 KB
testcase_12 AC 2 ms
6,944 KB
testcase_13 AC 2 ms
6,940 KB
testcase_14 AC 2 ms
6,944 KB
testcase_15 AC 1 ms
6,940 KB
testcase_16 AC 2 ms
6,940 KB
testcase_17 AC 2 ms
6,944 KB
testcase_18 AC 1 ms
6,940 KB
testcase_19 AC 2 ms
6,940 KB
testcase_20 AC 2 ms
6,944 KB
testcase_21 AC 2 ms
6,940 KB
testcase_22 AC 2 ms
6,940 KB
testcase_23 AC 2 ms
6,944 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,944 KB
testcase_28 AC 1 ms
6,940 KB
testcase_29 AC 2 ms
6,940 KB
testcase_30 AC 2 ms
6,940 KB
testcase_31 AC 2 ms
6,944 KB
testcase_32 AC 194 ms
8,404 KB
testcase_33 AC 146 ms
6,940 KB
testcase_34 AC 279 ms
9,528 KB
testcase_35 AC 249 ms
9,132 KB
testcase_36 AC 298 ms
9,964 KB
testcase_37 AC 162 ms
7,124 KB
testcase_38 AC 165 ms
8,168 KB
testcase_39 AC 315 ms
9,972 KB
testcase_40 AC 221 ms
8,844 KB
testcase_41 AC 290 ms
9,676 KB
testcase_42 AC 197 ms
8,704 KB
testcase_43 AC 224 ms
9,116 KB
testcase_44 AC 268 ms
9,708 KB
testcase_45 AC 195 ms
8,712 KB
testcase_46 AC 321 ms
10,104 KB
testcase_47 AC 84 ms
6,940 KB
testcase_48 AC 205 ms
8,772 KB
testcase_49 AC 337 ms
10,324 KB
testcase_50 AC 175 ms
7,192 KB
testcase_51 AC 159 ms
7,028 KB
testcase_52 AC 406 ms
14,496 KB
testcase_53 AC 398 ms
14,604 KB
testcase_54 AC 580 ms
20,876 KB
testcase_55 AC 601 ms
21,004 KB
testcase_56 AC 605 ms
21,004 KB
testcase_57 AC 581 ms
21,516 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#define _GLIBCXX_DEBUG //遅い可能性がある 
#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