結果

問題 No.2307 [Cherry 5 th Tune *] Cool 46
ユーザー random contestantrandom contestant
提出日時 2023-05-19 22:02:41
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,718 bytes
コンパイル時間 7,324 ms
コンパイル使用メモリ 267,644 KB
実行使用メモリ 15,368 KB
最終ジャッジ日時 2023-08-23 03:11:01
合計ジャッジ時間 44,934 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
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 AC 521 ms
13,872 KB
testcase_33 AC 552 ms
13,984 KB
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 AC 350 ms
4,376 KB
testcase_39 AC 487 ms
4,380 KB
testcase_40 AC 354 ms
4,376 KB
testcase_41 WA -
testcase_42 WA -
testcase_43 WA -
testcase_44 AC 354 ms
4,748 KB
testcase_45 AC 352 ms
4,744 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: ラムダ関数内:
main.cpp:59:5: 警告: 制御が非 void 関数の終りに到達しました [-Wreturn-type]
   59 |     };
      |     ^

ソースコード

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;
  vl a(n);
  vl b(m);
  rep(i,n) cin >> a[i];
  rep(i,m) cin >> b[i];
  if (n == 0 || m == 0){
    cout << "Yes" << endl;
    for(auto x : a) cout << "Red " << x << endl;
    for(auto x : b) cout << "Blue " << x << endl;
    return;
  }
  // abが共に等しいとき、移動することができる
  // a同士、b同士は相異なるため、同じ数値のペアだけを考えればよい
  set<int> amp;
  set<int> bmp;
  rep(i,n) amp.insert(a[i]);
  rep(i,m) bmp.insert(b[i]);
  vl ab;
  for(auto i : amp) if (bmp.count(i)) {
    ab.push_back(i);
  }
  if (ab.size() == 0) cout << "No" << endl;
  else {
    cout << "Yes" << endl;
    // 具体的な解答例を出力する
    for(auto i : amp) if (!bmp.count(i)) {
      cout << "Red " << i << endl;
    }
    cout << "Red " << ab[0] << endl;
    cout << "Blue " << ab[0] << endl;
    for(auto i : bmp) if (!amp.count(i)) {
      cout << "Blue " << i << endl;
    }
    bool c = 0;
    auto teban = [&]() -> string {
      c ^= 1;
      if (c) return "Blue ";
      if (!c) return "Red ";
    };
    for(int i = 1; i < ab.size(); ++i){
      cout << teban() << ab[i] << endl;
      cout << teban() << ab[i] << endl;
    }
  }
}

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