結果
問題 | No.2307 [Cherry 5 th Tune *] Cool 46 |
ユーザー | norikame |
提出日時 | 2023-05-19 22:01:04 |
言語 | C++23 (gcc 12.3.0 + boost 1.83.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,985 bytes |
コンパイル時間 | 7,785 ms |
コンパイル使用メモリ | 317,400 KB |
実行使用メモリ | 17,264 KB |
最終ジャッジ日時 | 2023-08-23 03:10:09 |
合計ジャッジ時間 | 41,366 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | WA | - |
testcase_01 | AC | 2 ms
4,376 KB |
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 | WA | - |
testcase_34 | WA | - |
testcase_35 | WA | - |
testcase_36 | WA | - |
testcase_37 | WA | - |
testcase_38 | AC | 370 ms
4,376 KB |
testcase_39 | AC | 509 ms
4,380 KB |
testcase_40 | AC | 383 ms
4,376 KB |
testcase_41 | AC | 381 ms
4,376 KB |
testcase_42 | AC | 435 ms
13,796 KB |
testcase_43 | AC | 436 ms
15,404 KB |
testcase_44 | AC | 448 ms
16,496 KB |
testcase_45 | AC | 439 ms
16,340 KB |
ソースコード
// #include <bits/stdc++.h> #include <atcoder/all> using namespace std; using namespace atcoder; using ll = long long; #define rep(i, n) for (int i=0; i<(int)(n); ++(i)) #define rep3(i, m, n) for (int i=(m); (i)<(int)(n); ++(i)) #define repr(i, n) for (int i=(int)(n)-1; (i)>=0; --(i)) #define rep3r(i, m, n) for (int i=(int)(n)-1; (i)>=(int)(m); --(i)) #define all(x) (x).begin(), (x).end() const int INF = (int)(1e9); int main() { int t0; cin >> t0; rep(i0, t0) { int n, m; cin >> n >> m; vector<int> a(n), b(m); rep(i, n) cin >> a[i]; rep(i, m) cin >> b[i]; unordered_set<int> ast(all(a)), bst(all(b)); vector<int> clst; for (auto itr=ast.begin(); itr!=ast.end(); ) { if (bst.find(*itr) != bst.end()) { clst.push_back(*itr); bst.erase(*itr); itr = ast.erase(itr); } else ++itr; } vector<pair<bool, int>> res; if (clst.empty()) { if (!ast.empty() && !bst.empty()) { cout << "No" << endl; continue; } else if (ast.empty()) { for (const int& vi : bst) res.emplace_back(true, vi); } else { for (const int& vi : ast) res.emplace_back(false, vi); } } else { for (const int& vi : clst) { if ((int)(res.size())/2%2 == 0) { res.emplace_back(false, vi); res.emplace_back(true, vi); } else { res.emplace_back(true, vi); res.emplace_back(false, vi); } } auto tmp2 = res.back(); res.pop_back(); auto tmp1 = res.back(); res.pop_back(); if (!tmp1.first) { for (const int& vi : ast) res.emplace_back(false, vi); res.push_back(tmp1); for (const int& vi : bst) res.emplace_back(true, vi); res.push_back(tmp2); } else { for (const int& vi : bst) res.emplace_back(true, vi); res.push_back(tmp1); for (const int& vi : ast) res.emplace_back(false, vi); res.push_back(tmp2); } } cout << "Yes" << endl; for (const auto& pi : res) cout << (!pi.first ? "Red" : "Blue") << ' ' << pi.second << endl; } return 0; }