結果

問題 No.2307 [Cherry 5 th Tune *] Cool 46
ユーザー hourenhouren
提出日時 2023-05-19 21:55:34
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 183 ms / 2,000 ms
コード長 1,691 bytes
コンパイル時間 1,680 ms
コンパイル使用メモリ 175,396 KB
実行使用メモリ 12,828 KB
最終ジャッジ日時 2023-08-23 03:00:11
合計ジャッジ時間 28,314 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 50 ms
4,376 KB
testcase_03 AC 63 ms
4,376 KB
testcase_04 AC 56 ms
4,380 KB
testcase_05 AC 58 ms
4,380 KB
testcase_06 AC 60 ms
4,380 KB
testcase_07 AC 57 ms
4,380 KB
testcase_08 AC 91 ms
6,500 KB
testcase_09 AC 84 ms
6,092 KB
testcase_10 AC 77 ms
5,280 KB
testcase_11 AC 92 ms
5,660 KB
testcase_12 AC 84 ms
6,592 KB
testcase_13 AC 85 ms
4,664 KB
testcase_14 AC 106 ms
7,940 KB
testcase_15 AC 68 ms
4,500 KB
testcase_16 AC 75 ms
4,548 KB
testcase_17 AC 81 ms
6,252 KB
testcase_18 AC 153 ms
9,836 KB
testcase_19 AC 130 ms
7,900 KB
testcase_20 AC 81 ms
5,200 KB
testcase_21 AC 81 ms
5,232 KB
testcase_22 AC 157 ms
10,216 KB
testcase_23 AC 82 ms
5,124 KB
testcase_24 AC 167 ms
10,488 KB
testcase_25 AC 160 ms
10,144 KB
testcase_26 AC 84 ms
5,332 KB
testcase_27 AC 159 ms
10,336 KB
testcase_28 AC 96 ms
6,080 KB
testcase_29 AC 105 ms
6,716 KB
testcase_30 AC 160 ms
9,592 KB
testcase_31 AC 81 ms
5,264 KB
testcase_32 AC 81 ms
5,140 KB
testcase_33 AC 177 ms
12,240 KB
testcase_34 AC 173 ms
11,672 KB
testcase_35 AC 147 ms
8,596 KB
testcase_36 AC 94 ms
6,200 KB
testcase_37 AC 147 ms
9,392 KB
testcase_38 AC 40 ms
4,380 KB
testcase_39 AC 63 ms
4,380 KB
testcase_40 AC 57 ms
4,376 KB
testcase_41 AC 70 ms
4,380 KB
testcase_42 AC 142 ms
8,416 KB
testcase_43 AC 136 ms
8,456 KB
testcase_44 AC 183 ms
12,828 KB
testcase_45 AC 42 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
#define fix(x) fixed << setprecision(x)
#define asc(x) x, vector<x>, greater<x>
#define rep(i, n) for(ll i = 0; i < n; i++)
#define all(x) (x).begin(),(x).end()
template<class T>bool chmin(T&a, const T&b){if(a>b){a=b;return 1;}return 0;}
template<class T>bool chmax(T&a, const T&b){if(a<b){a=b;return 1;}return 0;}
constexpr ll INFLL = (1LL << 62), MOD = 998244353;
constexpr int INF = (1 << 30);

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int t;
    cin >> t;
    rep(houren,t){
        int n,m,a;
        cin >> n >> m;
        set<int> se;
        vector<int> ok, ng;
        rep(i,n){
            cin >> a;
            se.insert(a);
        }
        rep(i,m){
            cin >> a;
            if(se.count(a)){
                se.erase(a);
                ok.push_back(a);
            }else{
                ng.push_back(a);
            }
        }
        if(se.size()&&ng.size()&&!ok.size()){
            cout << "No\n";
        }else{
            cout << "Yes\n";
            for(int x:se) cout << "Red " << x << '\n';
            if(ok.size()) cout << "Red " << ok[0] << '\n';
            if(ok.size()) cout << "Blue " << ok[0] << '\n';
            for(int x:ng) cout << "Blue " << x << '\n';
            for(int i=1;i<ok.size();i++){
                if(i&1){
                    cout << "Blue " << ok[i] << '\n';
                    cout  << "Red " << ok[i] << '\n';
                }else{
                    cout << "Red " << ok[i] << '\n';
                    cout << "Blue " << ok[i] << '\n';
                }
            }
        }
    }
    return 0;
}
0