結果
| 問題 | No.2307 [Cherry 5 th Tune *] Cool 46 |
| コンテスト | |
| ユーザー |
inkyaman
|
| 提出日時 | 2024-04-07 00:50:52 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 690 ms / 2,000 ms |
| コード長 | 1,672 bytes |
| コンパイル時間 | 1,583 ms |
| コンパイル使用メモリ | 122,776 KB |
| 最終ジャッジ日時 | 2025-02-20 22:40:52 |
|
ジャッジサーバーID (参考情報) |
judge2 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 46 |
ソースコード
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <math.h>
#include <cmath>
#include <stack>
#include <map>
#include <set>
#include <numeric>
#include <iomanip>
#include <climits>
#include <functional>
#include <cassert>
#include <tuple>
using namespace std;
using ll = long long;
int T;
int main() {
cin >> T;
while(T--) {
int N, M;
cin >> N >> M;
set<int> A,B,P;
for(int i = 0; i < N; ++i) {
int a; cin >> a;
A.insert(a);
}
for(int i = 0; i < M; ++i) {
int b; cin >> b;
if(A.find(b) != A.end()) {
A.erase(b);
P.insert(b);
}
else B.insert(b);
}
if(N>0 && M>0 && P.empty()) {
cout << "No" << endl;
continue;
} else cout << "Yes" << endl;
if(!A.empty())for(auto v : A) cout << "Red " << v << endl;
if(!P.empty()) {
int x = *P.begin();
cout << "Red " << x << endl;
cout << "Blue " << x << endl;
}
if(!B.empty())for(auto v : B) cout << "Blue " << v << endl;
if(P.size()>1) {
int cnt = 0;
for(int x : P) {
if(*P.begin() == x) continue;
if(cnt%2 == 0) {
cout << "Blue " << x << endl;
cout << "Red " << x << endl;
} else {
cout << "Red " << x << endl;
cout << "Blue " << x << endl;
}
cnt++;
}
}
}
}
inkyaman