結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 54 ms
4,376 KB
testcase_03 AC 58 ms
4,380 KB
testcase_04 AC 57 ms
4,384 KB
testcase_05 AC 56 ms
4,376 KB
testcase_06 AC 57 ms
4,376 KB
testcase_07 AC 51 ms
4,380 KB
testcase_08 AC 61 ms
4,376 KB
testcase_09 AC 61 ms
4,376 KB
testcase_10 AC 58 ms
4,380 KB
testcase_11 AC 68 ms
4,380 KB
testcase_12 AC 58 ms
4,376 KB
testcase_13 OLE -
testcase_14 AC 61 ms
4,376 KB
testcase_15 AC 55 ms
4,380 KB
testcase_16 AC 70 ms
4,376 KB
testcase_17 AC 62 ms
4,376 KB
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 AC 60 ms
4,376 KB
testcase_39 AC 88 ms
4,376 KB
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(100, '0') << v << '\n';

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

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

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

    while(T--) solve();

    assert(s <= 200000);
}
0