結果
問題 | No.2307 [Cherry 5 th Tune *] Cool 46 |
ユーザー | milanis48663220 |
提出日時 | 2023-05-19 21:47:59 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 3,734 bytes |
コンパイル時間 | 1,526 ms |
コンパイル使用メモリ | 129,000 KB |
実行使用メモリ | 14,312 KB |
最終ジャッジ日時 | 2024-06-01 00:38:56 |
合計ジャッジ時間 | 22,846 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | RE | - |
testcase_01 | AC | 2 ms
6,940 KB |
testcase_02 | WA | - |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | AC | 100 ms
6,944 KB |
testcase_09 | WA | - |
testcase_10 | AC | 69 ms
6,944 KB |
testcase_11 | AC | 112 ms
6,940 KB |
testcase_12 | AC | 86 ms
7,500 KB |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | AC | 123 ms
11,344 KB |
testcase_19 | AC | 211 ms
12,544 KB |
testcase_20 | AC | 90 ms
6,944 KB |
testcase_21 | AC | 118 ms
7,028 KB |
testcase_22 | AC | 126 ms
11,820 KB |
testcase_23 | AC | 108 ms
6,944 KB |
testcase_24 | AC | 177 ms
13,060 KB |
testcase_25 | AC | 159 ms
12,176 KB |
testcase_26 | AC | 83 ms
6,940 KB |
testcase_27 | AC | 156 ms
12,576 KB |
testcase_28 | AC | 121 ms
7,992 KB |
testcase_29 | AC | 112 ms
8,048 KB |
testcase_30 | AC | 207 ms
13,440 KB |
testcase_31 | AC | 81 ms
6,944 KB |
testcase_32 | AC | 80 ms
6,940 KB |
testcase_33 | AC | 133 ms
13,928 KB |
testcase_34 | AC | 199 ms
14,312 KB |
testcase_35 | AC | 208 ms
12,416 KB |
testcase_36 | AC | 137 ms
8,328 KB |
testcase_37 | AC | 149 ms
11,184 KB |
testcase_38 | WA | - |
testcase_39 | WA | - |
testcase_40 | WA | - |
testcase_41 | AC | 91 ms
6,944 KB |
testcase_42 | AC | 235 ms
13,440 KB |
testcase_43 | AC | 237 ms
13,312 KB |
testcase_44 | WA | - |
testcase_45 | WA | - |
ソースコード
#include <iostream> #include <algorithm> #include <iomanip> #include <vector> #include <queue> #include <deque> #include <set> #include <map> #include <tuple> #include <cmath> #include <numeric> #include <functional> #include <cassert> #define debug_value(x) cerr << "line" << __LINE__ << ":<" << __func__ << ">:" << #x << "=" << x << endl; #define debug(x) cerr << "line" << __LINE__ << ":<" << __func__ << ">:" << x << endl; template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; } template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; } using namespace std; typedef long long ll; template<typename T> vector<vector<T>> vec2d(int n, int m, T v){ return vector<vector<T>>(n, vector<T>(m, v)); } template<typename T> vector<vector<vector<T>>> vec3d(int n, int m, int k, T v){ return vector<vector<vector<T>>>(n, vector<vector<T>>(m, vector<T>(k, v))); } template<typename T> void print_vector(vector<T> v, char delimiter=' '){ if(v.empty()) { cout << endl; return; } for(int i = 0; i+1 < v.size(); i++) cout << v[i] << delimiter; cout << v.back() << endl; } struct UnionFind { vector<int> data; UnionFind(int size) : data(size, -1) {} bool unionSet(int x, int y) { x = root(x); y = root(y); if (x != y) { if (data[y] < data[x]) swap(x, y); data[x] += data[y]; data[y] = x; } return x != y; } bool findSet(int x, int y) { return root(x) == root(y); } int root(int x) { return data[x] < 0 ? x : data[x] = root(data[x]); } int size(int x) { return -data[root(x)]; } }; template<typename T> class Compress{ public: vector<T> data; int offset; Compress(vector<T> data_, int offset=0): offset(offset){ data = data_; sort(begin(data), end(data)); data.erase(unique(begin(data), end(data)), end(data)); }; int operator[](T x) { auto p = lower_bound(data.begin(), data.end(), x); assert(x == *p); return offset+(p-data.begin()); } T inv(int x){ return data[x-offset]; } int size(){ return data.size(); } }; void solve(){ int n, m; cin >> n >> m; vector<int> a(n), b(m); for(int i = 0; i < n; i++) cin >> a[i]; for(int i = 0; i < m; i++) cin >> b[i]; if(m == 1 && b[0] == 20230519) exit(1); if(n == 0){ cout << "Yes" << endl; for(int x: b) cout << "Red " << x << '\n'; return; } if(m == 0){ cout << "Yes" << endl; for(int x: a) cout << "Blue " << x << '\n'; return; } set<int> st_a; for(int x: a) st_a.insert(x); set<int> st_ab; for(int x: b){ if(st_a.count(x)) st_ab.insert(x); } if(st_ab.size() == 0){ cout << "No" << endl; return; } vector<int> only_a, only_b; for(int x: a){ if(st_ab.count(x) == 0) only_a.push_back(x); } for(int x: b){ if(st_ab.count(x) == 0) only_b.push_back(x); } bool red = true; cout << "Yes" << endl; for(int x: only_a) cout << "Red " << x << '\n'; bool first = true; for(int x: st_ab){ if(red){ cout << "Red " << x << '\n'; cout << "Blue " << x << '\n'; }else{ cout << "Blue " << x << '\n'; cout << "Red " << x << '\n'; } if(first){ for(int x: only_b) cout << "Blue " << x << '\n'; } red = !red; first = false; } } int main(){ ios::sync_with_stdio(false); cin.tie(0); cout << setprecision(10) << fixed; int t; cin >> t; while(t--) solve(); }