From d8b3d67d904fc10b1dd19fc02734423c4c5da4af Mon Sep 17 00:00:00 2001 From: ShazidMahsrafi Date: Mon, 11 Dec 2023 23:00:08 +0600 Subject: [PATCH] added 1144C.cpp --- 1144C Two Shuffled Sequences/1144C.cpp | 130 +++++++++++++++++++++++++ 1 file changed, 130 insertions(+) create mode 100644 1144C Two Shuffled Sequences/1144C.cpp diff --git a/1144C Two Shuffled Sequences/1144C.cpp b/1144C Two Shuffled Sequences/1144C.cpp new file mode 100644 index 0000000..8edb9a5 --- /dev/null +++ b/1144C Two Shuffled Sequences/1144C.cpp @@ -0,0 +1,130 @@ +#include +using namespace std; + +// Short forms +#define int long long +#define ll long long +#define lld long double +#define ull unsigned long long +#define endl '\n' +#define ff first +#define ss second +#define all(x) x.begin(), x.end() +#define sz(x) (int)(x).size() +#define pb push_back +#define ppb pop_back +#define mp make_pair +#define ins insert +#define fr(i, a, b) for(int i=a; ib; --i) +#define nf(i, n) for(int i=n-1; i>=0; --i) + +// STLs +#define PII pair +#define VI vector +#define VVI vector> +#define SI set +#define SC set +#define MII map +#define VLL vector +#define VVL vector> +#define SL set + +// Outputs +#define yes cout<<"YES"< void _print(pair p); +template void _print(vector v);template void _print(set v); +template void _print(map v);template void _print(multiset v); +template void _print(pair p) {cerr << "{"; _print(p.first); cerr << ","; _print(p.second); cerr << "}";} +template void _print(vector v) {cerr << "[ "; for (T i : v) {_print(i); cerr << " ";} cerr << "]";} +template void _print(set v) {cerr << "[ "; for (T i : v) {_print(i); cerr << " ";} cerr << "]";} +template void _print(multiset v) {cerr << "[ "; for (T i : v) {_print(i); cerr << " ";} cerr << "]";} +template void _print(map v) {cerr << "[ "; for (auto i : v) {_print(i); cerr << " ";} cerr << "]";} + + +///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +void solve() +{ + int n; + cin>>n; + MII m; + fn(i,n) + { + int x; + cin>>x; + m[x]++; + } + if(n<3) + { + yes; + if(n==2) + { + auto it=m.begin(); + cout<<1<ff<ff<ff<2) + { + no; + return; + } + else if(it.ss==2) + b.pb(it.ff); + a.pb(it.ff); + } + yes; + cout<> TC; + while (TC--) solve(); +} \ No newline at end of file