結果
問題 | No.2307 [Cherry 5 th Tune *] Cool 46 |
ユーザー | wanui |
提出日時 | 2023-05-19 22:09:25 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 223 ms / 2,000 ms |
コード長 | 2,793 bytes |
コンパイル時間 | 2,524 ms |
コンパイル使用メモリ | 205,300 KB |
実行使用メモリ | 23,032 KB |
最終ジャッジ日時 | 2023-08-23 03:22:30 |
合計ジャッジ時間 | 30,818 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
4,380 KB |
testcase_01 | AC | 1 ms
4,376 KB |
testcase_02 | AC | 80 ms
4,380 KB |
testcase_03 | AC | 95 ms
4,376 KB |
testcase_04 | AC | 96 ms
4,380 KB |
testcase_05 | AC | 94 ms
4,376 KB |
testcase_06 | AC | 95 ms
4,380 KB |
testcase_07 | AC | 90 ms
4,380 KB |
testcase_08 | AC | 121 ms
8,924 KB |
testcase_09 | AC | 118 ms
10,276 KB |
testcase_10 | AC | 123 ms
10,240 KB |
testcase_11 | AC | 126 ms
8,712 KB |
testcase_12 | AC | 120 ms
9,160 KB |
testcase_13 | AC | 166 ms
9,952 KB |
testcase_14 | AC | 124 ms
12,008 KB |
testcase_15 | AC | 107 ms
7,616 KB |
testcase_16 | AC | 119 ms
7,840 KB |
testcase_17 | AC | 124 ms
9,452 KB |
testcase_18 | AC | 185 ms
19,676 KB |
testcase_19 | AC | 172 ms
16,676 KB |
testcase_20 | AC | 223 ms
22,912 KB |
testcase_21 | AC | 207 ms
19,840 KB |
testcase_22 | AC | 190 ms
19,644 KB |
testcase_23 | AC | 208 ms
20,036 KB |
testcase_24 | AC | 181 ms
18,348 KB |
testcase_25 | AC | 203 ms
19,332 KB |
testcase_26 | AC | 189 ms
18,860 KB |
testcase_27 | AC | 195 ms
19,708 KB |
testcase_28 | AC | 194 ms
18,908 KB |
testcase_29 | AC | 191 ms
19,552 KB |
testcase_30 | AC | 189 ms
17,068 KB |
testcase_31 | AC | 218 ms
23,032 KB |
testcase_32 | AC | 195 ms
22,984 KB |
testcase_33 | AC | 191 ms
21,620 KB |
testcase_34 | AC | 209 ms
19,844 KB |
testcase_35 | AC | 177 ms
17,532 KB |
testcase_36 | AC | 177 ms
18,296 KB |
testcase_37 | AC | 203 ms
19,280 KB |
testcase_38 | AC | 68 ms
4,380 KB |
testcase_39 | AC | 103 ms
4,376 KB |
testcase_40 | AC | 102 ms
4,380 KB |
testcase_41 | AC | 93 ms
4,376 KB |
testcase_42 | AC | 160 ms
16,696 KB |
testcase_43 | AC | 157 ms
16,764 KB |
testcase_44 | AC | 188 ms
21,548 KB |
testcase_45 | AC | 185 ms
21,688 KB |
ソースコード
#include <bits/stdc++.h> // clang-format off using namespace std; using ll=long long; using ull=unsigned long long; using pll=pair<ll,ll>; const ll INF=4e18; void print0(){}; template<typename H,typename... T> void print0(H h,T... t){cout<<h;print0(t...);} void print(){print0("\n");}; template<typename H,typename... T>void print(H h,T... t){print0(h);if(sizeof...(T)>0)print0(" ");print(t...);} void perr0(){}; template<typename H,typename... T> void perr0(H h,T... t){cerr<<h;perr0(t...);} void perr(){perr0("\n");}; template<typename H,typename... T>void perr(H h,T... t){perr0(h);if(sizeof...(T)>0)perr0(" ");perr(t...);} void ioinit() { cout<<fixed<<setprecision(15); cerr<<fixed<<setprecision(6); ios_base::sync_with_stdio(0); cin.tie(0); } #define debug1(a) { cerr<<#a<<":"<<a<<endl; } #define debug2(a,b) { cerr<<#a<<":"<<a<<" "<<#b<<":"<<b<<endl; } #define debug3(a,b,c) { cerr<<#a<<":"<<a<<" "<<#b<<":"<<b<<" "<<#c<<":"<<c<<endl; } #define debug4(a,b,c,d) { cerr<<#a<<":"<<a<<" "<<#b<<":"<<b<<" "<<#c<<":"<<c<<" "<<#d<<":"<<d<<endl; } // clang-format on void solve() { ll N, M; cin >> N >> M; unordered_set<ll> A; unordered_set<ll> B; for (ll i = 0; i < N; i++) { ll x; cin >> x; A.insert(x); } for (ll i = 0; i < M; i++) { ll x; cin >> x; B.insert(x); } unordered_set<ll> p; unordered_set<ll> aa; unordered_set<ll> bb; for (auto x : A) { if (B.count(x)) { p.insert(x); } else { aa.insert(x); } } for (auto x : B) { if (A.count(x)) { ; } else { bb.insert(x); } } if (p.size() == 0) { if (aa.size() == 0) { print("Yes"); for (auto x : bb) { print("Blue", x); } } else if (bb.size() == 0) { print("Yes"); for (auto x : aa) { print("Red", x); } } else { print("No"); } } else { print("Yes"); for (auto x : aa) { print("Red", x); } ll xp = -1; for (auto x : p) { xp = x; print("Red", x); print("Blue", x); break; } for (auto x : bb) { print("Blue", x); } bool blue = true; for (auto x : p) { if (x == xp) continue; if (blue) { print("Blue", x); print("Red", x); } else { print("Red", x); print("Blue", x); } blue = !blue; } } } int main() { ioinit(); ll T; cin >> T; while (T--) { solve(); } return 0; }