結果
問題 | No.2307 [Cherry 5 th Tune *] Cool 46 |
ユーザー |
|
提出日時 | 2023-05-19 22:02:41 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,718 bytes |
コンパイル時間 | 4,405 ms |
コンパイル使用メモリ | 259,796 KB |
最終ジャッジ日時 | 2025-02-13 01:57:12 |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 8 WA * 38 |
コンパイルメッセージ
main.cpp: In lambda function: main.cpp:59:5: warning: control reaches end of non-void function [-Wreturn-type] 59 | }; | ^
ソースコード
// #define _GLIBCXX_DEBUG#include <bits/stdc++.h>using namespace std;#include <atcoder/all>using namespace atcoder;using ll = long long;#define rep(i,n) for (ll i = 0; i < (n); ++i)using vl = vector<ll>;using vvl = vector<vl>;using P = pair<ll,ll>;#define pb push_back#define int long long#define double long double#define INF (ll) 3e18// Ctrl + Shift + B コンパイル// Ctrl + C 中断// ./m 実行void solve(){int n, m; cin >> n >> m;vl a(n);vl b(m);rep(i,n) cin >> a[i];rep(i,m) cin >> b[i];if (n == 0 || m == 0){cout << "Yes" << endl;for(auto x : a) cout << "Red " << x << endl;for(auto x : b) cout << "Blue " << x << endl;return;}// abが共に等しいとき、移動することができる// a同士、b同士は相異なるため、同じ数値のペアだけを考えればよいset<int> amp;set<int> bmp;rep(i,n) amp.insert(a[i]);rep(i,m) bmp.insert(b[i]);vl ab;for(auto i : amp) if (bmp.count(i)) {ab.push_back(i);}if (ab.size() == 0) cout << "No" << endl;else {cout << "Yes" << endl;// 具体的な解答例を出力するfor(auto i : amp) if (!bmp.count(i)) {cout << "Red " << i << endl;}cout << "Red " << ab[0] << endl;cout << "Blue " << ab[0] << endl;for(auto i : bmp) if (!amp.count(i)) {cout << "Blue " << i << endl;}bool c = 0;auto teban = [&]() -> string {c ^= 1;if (c) return "Blue ";if (!c) return "Red ";};for(int i = 1; i < ab.size(); ++i){cout << teban() << ab[i] << endl;cout << teban() << ab[i] << endl;}}}signed main(){int t; cin >> t;rep(_,t){solve();}}