結果
問題 | No.2307 [Cherry 5 th Tune *] Cool 46 |
ユーザー | snrnsidy |
提出日時 | 2023-05-19 21:40:24 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.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 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
5,248 KB |
testcase_01 | AC | 2 ms
5,248 KB |
testcase_02 | AC | 75 ms
5,248 KB |
testcase_03 | AC | 94 ms
5,248 KB |
testcase_04 | AC | 90 ms
5,248 KB |
testcase_05 | AC | 91 ms
5,248 KB |
testcase_06 | AC | 95 ms
5,248 KB |
testcase_07 | AC | 86 ms
5,248 KB |
testcase_08 | AC | 122 ms
14,548 KB |
testcase_09 | AC | 127 ms
10,188 KB |
testcase_10 | AC | 124 ms
12,796 KB |
testcase_11 | AC | 131 ms
15,236 KB |
testcase_12 | AC | 123 ms
14,820 KB |
testcase_13 | AC | 146 ms
15,896 KB |
testcase_14 | AC | 124 ms
13,280 KB |
testcase_15 | AC | 105 ms
10,648 KB |
testcase_16 | AC | 126 ms
10,304 KB |
testcase_17 | AC | 119 ms
12,628 KB |
testcase_18 | AC | 181 ms
23,900 KB |
testcase_19 | AC | 188 ms
23,760 KB |
testcase_20 | AC | 198 ms
24,396 KB |
testcase_21 | AC | 179 ms
24,332 KB |
testcase_22 | AC | 186 ms
24,312 KB |
testcase_23 | AC | 191 ms
24,356 KB |
testcase_24 | AC | 187 ms
23,860 KB |
testcase_25 | AC | 231 ms
24,052 KB |
testcase_26 | AC | 186 ms
24,396 KB |
testcase_27 | AC | 188 ms
24,224 KB |
testcase_28 | AC | 189 ms
24,204 KB |
testcase_29 | AC | 183 ms
24,212 KB |
testcase_30 | AC | 193 ms
23,776 KB |
testcase_31 | AC | 189 ms
24,264 KB |
testcase_32 | AC | 187 ms
24,392 KB |
testcase_33 | AC | 191 ms
24,284 KB |
testcase_34 | AC | 206 ms
24,296 KB |
testcase_35 | AC | 185 ms
23,800 KB |
testcase_36 | AC | 188 ms
24,292 KB |
testcase_37 | AC | 185 ms
24,120 KB |
testcase_38 | AC | 54 ms
5,248 KB |
testcase_39 | AC | 83 ms
5,248 KB |
testcase_40 | AC | 86 ms
5,248 KB |
testcase_41 | AC | 93 ms
5,248 KB |
testcase_42 | AC | 198 ms
23,504 KB |
testcase_43 | AC | 186 ms
23,632 KB |
testcase_44 | AC | 173 ms
24,216 KB |
testcase_45 | AC | 174 ms
24,276 KB |
ソースコード
#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; }