結果
問題 | No.2307 [Cherry 5 th Tune *] Cool 46 |
ユーザー | gyozasukisuki |
提出日時 | 2023-05-19 22:36:02 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 2,399 bytes |
コンパイル時間 | 1,910 ms |
コンパイル使用メモリ | 177,440 KB |
実行使用メモリ | 12,800 KB |
最終ジャッジ日時 | 2024-06-01 01:27:59 |
合計ジャッジ時間 | 26,808 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | RE | - |
testcase_01 | RE | - |
testcase_02 | RE | - |
testcase_03 | RE | - |
testcase_04 | RE | - |
testcase_05 | RE | - |
testcase_06 | RE | - |
testcase_07 | RE | - |
testcase_08 | RE | - |
testcase_09 | RE | - |
testcase_10 | RE | - |
testcase_11 | RE | - |
testcase_12 | RE | - |
testcase_13 | RE | - |
testcase_14 | RE | - |
testcase_15 | RE | - |
testcase_16 | RE | - |
testcase_17 | RE | - |
testcase_18 | RE | - |
testcase_19 | RE | - |
testcase_20 | RE | - |
testcase_21 | RE | - |
testcase_22 | RE | - |
testcase_23 | RE | - |
testcase_24 | RE | - |
testcase_25 | WA | - |
testcase_26 | RE | - |
testcase_27 | RE | - |
testcase_28 | RE | - |
testcase_29 | RE | - |
testcase_30 | RE | - |
testcase_31 | RE | - |
testcase_32 | RE | - |
testcase_33 | AC | 525 ms
12,800 KB |
testcase_34 | RE | - |
testcase_35 | RE | - |
testcase_36 | RE | - |
testcase_37 | RE | - |
testcase_38 | AC | 357 ms
5,376 KB |
testcase_39 | RE | - |
testcase_40 | AC | 393 ms
5,376 KB |
testcase_41 | RE | - |
testcase_42 | RE | - |
testcase_43 | RE | - |
testcase_44 | AC | 523 ms
12,672 KB |
testcase_45 | AC | 513 ms
12,800 KB |
ソースコード
#include <bits/stdc++.h> //#include <atcoder/all> //using namespace atcoder; using namespace std; const int INF = 1e9; using ll = long long; using inv = vector<int>; using stv = vector<string>; using pint = pair<int,int>; #define FOR(i,l,r) for(int i=(l); i<(r); i++) #define rep(i,r) for(int i=0; i<(r); i++) #define repl(i,r) for(long long i=0; i<(r); i++) #define FORl(i,l,r) for(long long i=(l); i<(r); i++) #define INFL ((1LL<<62)-(1LL<<31)) #define pb(x) push_back(x) #define CIN(x) cin >> x int main(){ int T; cin >> T; rep(q,T){ int N,M; cin >> N >> M; set<ll> A,B; rep(i,N){ ll c; cin >> c; A.insert(c); } rep(i,M){ ll c; cin >> c; B.insert(c); } if(!N || !M){ if(!N){ cout << "Yes" << endl; for(auto b: B){ cout << "Blue " << b << endl; } continue; }else{ cout << "Yes" << endl; for(auto a: A){ cout << "Red " << a << endl; } continue; } } set<ll> S; // 共通のやつ for(auto C:A){ if(B.find(C) != B.end()){ S.insert(C); B.erase(C); A.erase(C); } } if(S.empty() && !A.empty() && !B.empty()){ cout << "No" << endl; continue; } cout << "Yes" << endl; bool nowA = true; if(A.empty()){ nowA = false; } if(B.empty()){ nowA = true; } if(!nowA){ for(auto b:B){ cout << "Blue " << b << endl; } for(auto s:S){ cout << (nowA ? "Red ":"Blue ") << s << endl; cout << (!nowA ? "Red ":"Blue ") << s << endl; nowA = !nowA; } continue; } else if(B.empty()){ for(auto a:A){ cout << "Red " << a << endl; } for(auto s:S){ cout << (nowA ? "Red ":"Blue ") << s << endl; cout << (!nowA ? "Red ":"Blue ") << s << endl; nowA = !nowA; } continue; }else{ bool first = true; for(auto a:A){ cout << "Red " << a << endl; } for(auto s:S){ cout << (nowA ? "Red ":"Blue ") << s << endl; cout << (!nowA ? "Red ":"Blue ") << s << endl; if(first){ for(auto b: B){ cout << "Blue " << b << endl; } } nowA = !nowA; first = false; } } } return 0; }