結果

問題 No.2307 [Cherry 5 th Tune *] Cool 46
ユーザー t98slidert98slider
提出日時 2023-02-23 20:54:31
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
OLE  
実行時間 -
コード長 1,762 bytes
コンパイル時間 2,020 ms
コンパイル使用メモリ 174,828 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-23 02:23:28
合計ジャッジ時間 129,636 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 OLE -
testcase_03 OLE -
testcase_04 OLE -
testcase_05 OLE -
testcase_06 OLE -
testcase_07 OLE -
testcase_08 OLE -
testcase_09 OLE -
testcase_10 OLE -
testcase_11 OLE -
testcase_12 OLE -
testcase_13 OLE -
testcase_14 OLE -
testcase_15 OLE -
testcase_16 OLE -
testcase_17 OLE -
testcase_18 OLE -
testcase_19 OLE -
testcase_20 OLE -
testcase_21 OLE -
testcase_22 OLE -
testcase_23 OLE -
testcase_24 OLE -
testcase_25 OLE -
testcase_26 OLE -
testcase_27 OLE -
testcase_28 OLE -
testcase_29 OLE -
testcase_30 OLE -
testcase_31 OLE -
testcase_32 OLE -
testcase_33 OLE -
testcase_34 OLE -
testcase_35 OLE -
testcase_36 OLE -
testcase_37 OLE -
testcase_38 OLE -
testcase_39 OLE -
testcase_40 OLE -
testcase_41 OLE -
testcase_42 OLE -
testcase_43 OLE -
testcase_44 OLE -
testcase_45 OLE -
権限があれば一括ダウンロードができます

ソースコード

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(1000, '0') << v << '\n';

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

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

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

    while(T--) solve();

    assert(s <= 200000);
}
0