結果

問題 No.2307 [Cherry 5 th Tune *] Cool 46
ユーザー t98slidert98slider
提出日時 2023-02-23 20:55:58
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 154 ms / 2,000 ms
コード長 1,750 bytes
コンパイル時間 2,656 ms
コンパイル使用メモリ 175,112 KB
実行使用メモリ 5,144 KB
最終ジャッジ日時 2023-08-23 02:20:33
合計ジャッジ時間 31,164 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 52 ms
4,380 KB
testcase_03 AC 54 ms
4,380 KB
testcase_04 AC 53 ms
4,380 KB
testcase_05 AC 53 ms
4,380 KB
testcase_06 AC 55 ms
4,376 KB
testcase_07 AC 48 ms
4,376 KB
testcase_08 AC 58 ms
4,376 KB
testcase_09 AC 58 ms
4,380 KB
testcase_10 AC 55 ms
4,376 KB
testcase_11 AC 65 ms
4,380 KB
testcase_12 AC 54 ms
4,376 KB
testcase_13 AC 75 ms
4,376 KB
testcase_14 AC 58 ms
4,380 KB
testcase_15 AC 52 ms
4,376 KB
testcase_16 AC 65 ms
4,380 KB
testcase_17 AC 59 ms
4,380 KB
testcase_18 AC 76 ms
5,008 KB
testcase_19 AC 79 ms
4,508 KB
testcase_20 AC 76 ms
4,832 KB
testcase_21 AC 77 ms
4,864 KB
testcase_22 AC 77 ms
4,732 KB
testcase_23 AC 77 ms
4,840 KB
testcase_24 AC 77 ms
4,760 KB
testcase_25 AC 77 ms
4,736 KB
testcase_26 AC 76 ms
4,984 KB
testcase_27 AC 79 ms
4,772 KB
testcase_28 AC 78 ms
5,032 KB
testcase_29 AC 79 ms
4,964 KB
testcase_30 AC 78 ms
4,468 KB
testcase_31 AC 77 ms
4,888 KB
testcase_32 AC 77 ms
4,968 KB
testcase_33 AC 77 ms
4,836 KB
testcase_34 AC 77 ms
5,116 KB
testcase_35 AC 77 ms
4,612 KB
testcase_36 AC 78 ms
5,040 KB
testcase_37 AC 78 ms
5,144 KB
testcase_38 AC 57 ms
4,376 KB
testcase_39 AC 84 ms
4,376 KB
testcase_40 AC 68 ms
4,380 KB
testcase_41 AC 68 ms
4,376 KB
testcase_42 AC 75 ms
4,948 KB
testcase_43 AC 77 ms
4,520 KB
testcase_44 AC 154 ms
4,736 KB
testcase_45 AC 75 ms
4,944 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);

    int T, s = 0;
    cin >> T;
    assert(1 <= T && T <= 200000);

    auto solve = [&](){
        int N, M;
        cin >> N >> M;
        s += N + M;
        assert(0 <= N && 0 <= M);
        vector<int> A(N), B(M), ab, a, b;
        for(auto &v : A){
            cin >> v;
            assert(1 <= v && v <= 1000000000);
        }
        for(auto &v : B){
            cin >> v;
            assert(1 <= v && v <= 1000000000);
        }

        sort(A.begin(), A.end());
        sort(B.begin(), B.end());
        set_intersection(A.begin(), A.end(), B.begin(), B.end(), inserter(ab, ab.end()));
        set_difference(A.begin(), A.end(), ab.begin(), ab.end(), inserter(a, a.end()));
        set_difference(B.begin(), B.end(), ab.begin(), ab.end(), inserter(b, b.end()));

        if(!a.empty() && !b.empty() && ab.empty()){
            cout << "No" << '\n';
            return;
        }

        cout << "Yes" << '\n';

        for(auto &v : b)cout << "Blue " << string(50, '0') << v << '\n';

        if(!ab.empty()){
            cout << "Blue " << ab[0] << '\n';
            cout << "Red " << ab[0] << '\n';
        }

        for(auto &v : a)cout << "Red " << string(50, '0') << v << '\n';

        for(int i = 1; i < ab.size(); i++){
            if(i & 1){
                cout << "Red " << string(50, '0') << ab[i] << '\n';
                cout << "Blue " << string(50, '0') << ab[i] << '\n';
            }else{
                cout << "Blue " << string(50, '0') << ab[i] << '\n';
                cout << "Red " << string(50, '0') << ab[i] << '\n';
            }
        }
    };

    while(T--) solve();

    assert(s <= 200000);
}
0