結果
問題 | No.2307 [Cherry 5 th Tune *] Cool 46 |
ユーザー | hiro71687k |
提出日時 | 2023-05-21 00:52:44 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 3,507 bytes |
コンパイル時間 | 2,839 ms |
コンパイル使用メモリ | 216,740 KB |
実行使用メモリ | 30,464 KB |
最終ジャッジ日時 | 2024-12-21 12:58:31 |
合計ジャッジ時間 | 44,201 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
5,248 KB |
testcase_01 | WA | - |
testcase_02 | WA | - |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | WA | - |
testcase_20 | WA | - |
testcase_21 | WA | - |
testcase_22 | WA | - |
testcase_23 | WA | - |
testcase_24 | WA | - |
testcase_25 | WA | - |
testcase_26 | WA | - |
testcase_27 | WA | - |
testcase_28 | WA | - |
testcase_29 | WA | - |
testcase_30 | WA | - |
testcase_31 | WA | - |
testcase_32 | AC | 542 ms
20,296 KB |
testcase_33 | AC | 746 ms
30,464 KB |
testcase_34 | WA | - |
testcase_35 | WA | - |
testcase_36 | WA | - |
testcase_37 | WA | - |
testcase_38 | AC | 371 ms
5,248 KB |
testcase_39 | AC | 525 ms
5,248 KB |
testcase_40 | AC | 420 ms
5,248 KB |
testcase_41 | WA | - |
testcase_42 | WA | - |
testcase_43 | WA | - |
testcase_44 | AC | 524 ms
18,816 KB |
testcase_45 | AC | 517 ms
18,816 KB |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll=long long; using ld=long double; ld pie=3.141592653589793; ll inf=300000000; ll mod=998244353; int main(){ ll t; cin >> t; for (ll o = 0; o < t; o++) { ll n,m; cin >> n >> m; vector<ll>a(n),b(m); map<ll,ll>memo; for (ll i = 0; i < n; i++) { cin >> a[i]; memo[a[i]]+=1; } map<ll,ll>mm; vector<ll>aa(n,0),bb(m,0); ll now=0; for (ll i = 0; i < m; i++) { cin >> b[i]; if (memo[b[i]]>=1) { now++; bb.push_back(i); memo[b[i]]--; mm[b[i]]+=1; bb[i]=1; } } if (n==0) { cout << "Yes" << endl; for (ll i = 0; i < m; i++) { cout << "Blue " << b[i] << endl; } continue; } if (m==0) { cout << "Yes" << endl; for (ll i = 0; i < n; i++) { cout << "Red " << a[i] << endl; } continue; } for (ll i = 0; i < n; i++) { if (mm[a[i]]>=1) { mm[a[i]]--; aa[i]=1; } } if (now==0) { cout << "No" << endl; continue; } if (now%2) { cout << "Yes" << endl; for (ll i = 0; i < n; i++) { if (aa[i]==0) { cout << "Red " << a[i] << endl; } } ll x=0; for (ll i = 0; i < n; i++) { if (aa[i]==1) { if (x%2==0) { cout << "Red " << a[i]<< endl; cout << "Blue " << a[i] << endl; }else{ cout << "Blue " << a[i] << endl; cout << "Red " << a[i]<< endl; } } } for (ll i = 0; i < m; i++) { if (bb[i]==0) { cout << "Blue " << b[i] << endl; } } }else{ cout << "Yes" << endl; ll saisyo=inf; for (ll i = 0; i < n; i++) { if (aa[i]==0) { cout << "Red " << a[i] << endl; }else{ saisyo=min(saisyo,i); } } cout << "Red " << a[saisyo] << endl; cout << "Blue " << a[saisyo] << endl; ll x=1; for (ll i = 0; i < m; i++) { if (bb[i]==0) { cout << "Blue " << b[i] << endl; } } for (ll i = 0; i < n; i++) { if (aa[i]==1&&i!=saisyo) { if (x%2==0) { cout << "Red " << a[i]<< endl; cout << "Blue " << a[i] << endl; }else{ cout << "Blue " << a[i] << endl; cout << "Red " << a[i]<< endl; } } } } } }