結果

問題 No.1795 AtCoder Heuristic Rating coloring
ユーザー Kanten4205Kanten4205
提出日時 2021-12-15 22:54:13
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 271 ms / 2,000 ms
コード長 1,027 bytes
コンパイル時間 1,883 ms
コンパイル使用メモリ 179,860 KB
実行使用メモリ 11,900 KB
最終ジャッジ日時 2023-10-20 07:38:24
合計ジャッジ時間 8,818 ms
ジャッジサーバーID
(参考情報)
judge11 / 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 7 ms
4,348 KB
testcase_07 AC 7 ms
4,348 KB
testcase_08 AC 7 ms
4,348 KB
testcase_09 AC 8 ms
4,348 KB
testcase_10 AC 8 ms
4,348 KB
testcase_11 AC 8 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 2 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 2 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 3 ms
4,348 KB
testcase_29 AC 2 ms
4,348 KB
testcase_30 AC 2 ms
4,348 KB
testcase_31 AC 2 ms
4,348 KB
testcase_32 AC 104 ms
5,320 KB
testcase_33 AC 75 ms
4,528 KB
testcase_34 AC 150 ms
6,688 KB
testcase_35 AC 131 ms
6,160 KB
testcase_36 AC 148 ms
6,424 KB
testcase_37 AC 83 ms
4,792 KB
testcase_38 AC 81 ms
4,840 KB
testcase_39 AC 162 ms
6,952 KB
testcase_40 AC 110 ms
5,632 KB
testcase_41 AC 151 ms
6,688 KB
testcase_42 AC 98 ms
5,368 KB
testcase_43 AC 106 ms
5,368 KB
testcase_44 AC 133 ms
5,896 KB
testcase_45 AC 101 ms
5,368 KB
testcase_46 AC 170 ms
6,952 KB
testcase_47 AC 46 ms
4,372 KB
testcase_48 AC 100 ms
5,056 KB
testcase_49 AC 174 ms
7,148 KB
testcase_50 AC 95 ms
5,368 KB
testcase_51 AC 83 ms
5,104 KB
testcase_52 AC 224 ms
11,900 KB
testcase_53 AC 223 ms
11,900 KB
testcase_54 AC 265 ms
11,900 KB
testcase_55 AC 269 ms
11,900 KB
testcase_56 AC 271 ms
11,900 KB
testcase_57 AC 265 ms
11,900 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
const long long MOD1 = 1000000007;
const long long MOD2 = 998244353;
typedef long long ll;
//typedef int ll;
typedef pair<ll, ll> P;
const long long INF = 1e9;
template <typename T>
void input_arr(vector<T>& A, ll N) {
	for (ll i = 0; i < N; i++) {
		cin >> A[i];
	}
}
template <typename T, typename Q>
void input_arr(vector<pair<T, Q>>& A, ll N) {
	for (ll i = 0; i < N; i++) {
		cin >> A[i].first >> A[i].second;
	}
}
template <typename T>
void input_arr(vector<vector<T>>& A, ll H, ll W) {
	for (ll i = 0; i < H; i++) {
		for (ll j = 0; j < W; j++) {
			cin >> A[i][j];
		}
	}
}
int main() {
    ll N, M; cin >> N >> M;
    vector<pair<string, ll>>A(N + M);
    input_arr(A, N + M);
    sort(A.begin(), A.end());
    for (ll i = 0; i < N + M; i++) {
        if (i + 1 < N + M && A[i].first == A[i + 1].first) {
            cout << A[i + 1].first << ' ' << A[i + 1].second << endl;
            i++;
        }
        else cout << A[i].first << ' ' << A[i].second << endl;
    }
}
0