結果
| 問題 |
No.2307 [Cherry 5 th Tune *] Cool 46
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-02-23 20:54:31 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
OLE
|
| 実行時間 | - |
| コード長 | 1,762 bytes |
| コンパイル時間 | 2,140 ms |
| コンパイル使用メモリ | 178,560 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-12-20 03:33:37 |
| 合計ジャッジ時間 | 137,108 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 2 OLE * 44 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main(){
ios::sync_with_stdio(false);
cin.tie(0);
int T, s = 0;
cin >> T;
assert(1 <= T && T <= 200000);
auto solve = [&](){
int N, M;
cin >> N >> M;
s += N + M;
assert(0 <= N && 0 <= M);
vector<int> A(N), B(M), ab, a, b;
for(auto &v : A){
cin >> v;
assert(1 <= v && v <= 1000000000);
}
for(auto &v : B){
cin >> v;
assert(1 <= v && v <= 1000000000);
}
sort(A.begin(), A.end());
sort(B.begin(), B.end());
set_intersection(A.begin(), A.end(), B.begin(), B.end(), inserter(ab, ab.end()));
set_difference(A.begin(), A.end(), ab.begin(), ab.end(), inserter(a, a.end()));
set_difference(B.begin(), B.end(), ab.begin(), ab.end(), inserter(b, b.end()));
if(!a.empty() && !b.empty() && ab.empty()){
cout << "No" << '\n';
return;
}
cout << "Yes" << '\n';
for(auto &v : b)cout << "Blue " << string(1000, '0') << v << '\n';
if(!ab.empty()){
cout << "Blue " << ab[0] << '\n';
cout << "Red " << ab[0] << '\n';
}
for(auto &v : a)cout << "Red " << string(1000, '0') << v << '\n';
for(int i = 1; i < ab.size(); i++){
if(i & 1){
cout << "Red " << string(1000, '0') << ab[i] << '\n';
cout << "Blue " << string(1000, '0') << ab[i] << '\n';
}else{
cout << "Blue " << string(1000, '0') << ab[i] << '\n';
cout << "Red " << string(1000, '0') << ab[i] << '\n';
}
}
};
while(T--) solve();
assert(s <= 200000);
}