結果
問題 | No.2307 [Cherry 5 th Tune *] Cool 46 |
ユーザー | snrnsidy |
提出日時 | 2023-05-19 21:40:24 |
言語 | C++17(gcc12) (gcc 12.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 231 ms / 2,000 ms |
コード長 | 3,977 bytes |
コンパイル時間 | 4,155 ms |
コンパイル使用メモリ | 371,572 KB |
実行使用メモリ | 24,396 KB |
最終ジャッジ日時 | 2024-12-21 01:59:22 |
合計ジャッジ時間 | 31,987 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 46 |
ソースコード
#pragma GCC optimize("O3") #pragma GCC optimize(2) #pragma GCC optimize(3) #pragma GCC optimize("Ofast") #pragma GCC optimize("inline") #pragma GCC optimize("-fgcse") #pragma GCC optimize("-fgcse-lm") #pragma GCC optimize("-fipa-sra") #pragma GCC optimize("-ftree-pre") #pragma GCC optimize("-ftree-vrp") #pragma GCC optimize("-fpeephole2") #pragma GCC optimize("-ffast-math") #pragma GCC optimize("-fsched-spec") #pragma GCC optimize("unroll-loops") #pragma GCC optimize("-falign-jumps") #pragma GCC optimize("-falign-loops") #pragma GCC optimize("-falign-labels") #pragma GCC optimize("-fdevirtualize") #pragma GCC optimize("-fcaller-saves") #pragma GCC optimize("-fcrossjumping") #pragma GCC optimize("-fthread-jumps") #pragma GCC optimize("-funroll-loops") #pragma GCC optimize("-freorder-blocks") #pragma GCC optimize("-fschedule-insns") #pragma GCC optimize("inline-functions") #pragma GCC optimize("-ftree-tail-merge") #pragma GCC optimize("-fschedule-insns2") #pragma GCC optimize("-fstrict-aliasing") #pragma GCC optimize("-falign-functions") #pragma GCC optimize("-fcse-follow-jumps") #pragma GCC optimize("-fsched-interblock") #pragma GCC optimize("-fpartial-inlining") #pragma GCC optimize("no-stack-protector") #pragma GCC optimize("-freorder-functions") #pragma GCC optimize("-findirect-inlining") #pragma GCC optimize("-fhoist-adjacent-loads") #pragma GCC optimize("-frerun-cse-after-loop") #pragma GCC optimize("inline-small-functions") #pragma GCC optimize("-finline-small-functions") #pragma GCC optimize("-ftree-switch-conversion") #pragma GCC optimize("-foptimize-sibling-calls") #pragma GCC optimize("-fexpensive-optimizations") #pragma GCC optimize("inline-functions-called-once") #pragma GCC optimize("-fdelete-null-pointer-checks") #pragma GCC optimize("Ofast") //#pragma GCC target("avx,avx2,fma") //#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") //#pragma GCC optimization ("unroll-loops") #include <bits/stdc++.h> using namespace std; int main(void) { cin.tie(0); ios::sync_with_stdio(false); int tc; cin >> tc; while(tc--) { int n,m,t; vector <int> A,B,C; set <int> SA,SB; cin >> n >> m; for(int i=0;i<n;i++) { cin >> t; SA.insert(t); } for(int i=0;i<m;i++) { cin >> t; SB.insert(t); } for(auto it : SA) { if(SB.find(it)==SB.end()) { A.push_back(it); } } for(auto it : SB) { if(SA.find(it)==SA.end()) { B.push_back(it); } else { C.push_back(it); } } vector <pair<string,int>> res; for(auto it : A) { res.push_back(make_pair("Red",it)); } bool flag = true; int N = C.size(); if(N%2==1) { for(auto it : C) { if(flag) { res.push_back(make_pair("Red",it)); res.push_back(make_pair("Blue",it)); flag = false; } else { res.push_back(make_pair("Blue",it)); res.push_back(make_pair("Red",it)); flag = true; } } for(auto it : B) { res.push_back(make_pair("Blue",it)); } } else { if(N==0) { if(A.size()==0) { for(auto it : B) { res.push_back(make_pair("Blue",it)); } } } else { for(int j=0;j<N;j++) { auto it = C[j]; if(j==N-2) { res.push_back(make_pair("Red",it)); res.push_back(make_pair("Blue",it)); for(auto it2 : B) { res.push_back(make_pair("Blue",it2)); } flag = false; } else { if(flag) { res.push_back(make_pair("Red",it)); res.push_back(make_pair("Blue",it)); flag = false; } else { res.push_back(make_pair("Blue",it)); res.push_back(make_pair("Red",it)); flag = true; } } } } } if(res.size()==n+m) { cout << "Yes" << '\n'; for(auto it : res) { cout << it.first << ' ' << it.second << '\n'; } } else { cout << "No" << '\n'; } } return 0; }