結果

問題 No.2307 [Cherry 5 th Tune *] Cool 46
ユーザー random contestantrandom contestant
提出日時 2023-05-19 22:17:15
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,474 bytes
コンパイル時間 8,862 ms
コンパイル使用メモリ 267,940 KB
実行使用メモリ 16,172 KB
最終ジャッジ日時 2023-08-23 03:31:40
合計ジャッジ時間 43,410 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

// #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#include <atcoder/all>
using namespace atcoder;
using ll = long long;
#define rep(i,n) for (ll i = 0; i < (n); ++i)
using vl = vector<ll>;
using vvl = vector<vl>;
using P = pair<ll,ll>;
#define pb push_back
#define int long long
#define double long double
#define INF (ll) 3e18
// Ctrl + Shift + B コンパイル
// Ctrl + C 中断
// ./m 実行


void solve(){
  int n, m; cin >> n >> m;
  map<int, int> mp;
  rep(i, n) {
    int x; cin >> x;
    mp[x] += 1;
  }
  rep(i,m) {
    int x; cin >> x;
    mp[x] += 2;
  }
  if (n == 0 || m == 0){
    cout << "Yes" << endl;
    for(auto [x, ab] : mp){
      if (ab & 1) cout << "Red " << x << endl;
      if (ab & 2) cout << "Blue " << x << endl;
    }
    return;
  }
  vl three;
  for(auto [x, ab] : mp) if (ab == 3) three.push_back(x);
  if (!three.size()) {cout << "No" << endl; return;}
  cout << "Yes" << endl;
  for(auto [x, ab] : mp){
    if (ab == 1) cout << "Red " << x << endl;
  }
  cout << "Red " << three[0] << endl;
  cout << "Blue " << three[0] << endl;
  for(auto [x, ab] : mp){
    if (ab == 2) cout << "Blue " << x << endl;
  }
  int c = 0;
  auto teban = [&]() -> string {
    if (c) return "Blue ";
    else return "Red ";
  };
  for(int i = 1; i < three.size(); i++){
    cout << teban() << three[i] << endl;
    c ^= 1;
    cout << teban() << three[i] << endl;
  }
}

signed main(){
  int t; cin >> t;
  rep(_,t){
    solve();
  }
}
0