From 26b08981e90a5fd08aea91bc519a342350898cab Mon Sep 17 00:00:00 2001 From: 1nsayn18 <56519920+1nsayn18@users.noreply.github.com> Date: Tue, 26 Oct 2021 15:11:48 +0530 Subject: [PATCH] A.cpp Solution for question A --- a.cpp | 94 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 94 insertions(+) create mode 100644 a.cpp diff --git a/a.cpp b/a.cpp new file mode 100644 index 0000000..6d96124 --- /dev/null +++ b/a.cpp @@ -0,0 +1,94 @@ +#include +using namespace std; + +#define int long long int +#define ll long long +#define quickie ios_base::sync_with_stdio(false); cin.tie(NULL); +#define rep(i, a, b) for(int i=a; i +#define vi vector +#define mod 1000000007 +#define INF 1e17 +#define test int t; cin >> t; +#define all(a) a.begin(),a.end() +#define pi 3.141592653589 +#define fact(n) rep(i, 1, n+1)ft.pb((ft[i-1]*i)%mod) ; +int power(int x, int y) ; +int gcd(int a, int b) ; +vi ft = {1} ; +int modInv(int i) {return power(i,mod-2);} +int ncr(int n,int r) {return (n>=r?(ft[n]*modInv(ft[r]))%mod*modInv(ft[n-r])%mod:0);} + +int power(int x, int y) { + int res = 1; x %= mod ; + while (y > 0) { + if (y & 1) + res = (res*x)%mod ; + y = y>>1; + x = (x*x)%mod ; + } + return res%mod; +} + +int gcd(int a,int b) { + if(a==0) return b; + return gcd(b%a,a); +} + +// #include +// #include +// using namespace __gnu_pbds; +// template +// using ordered_set = tree,rb_tree_tag,tree_order_statistics_node_update>; +// template +// using ordered_multiset = tree,rb_tree_tag,tree_order_statistics_node_update>; +// (*****FOR USING ORDERED SET CHANGE INT*******) + +// struct chash { +// const int RANDOM = (long long)(make_unique().get()) ^ chrono::high_resolution_clock::now().time_since_epoch().count(); +// static unsigned long long hash_f(unsigned long long x) { +// x += 0x9e3779b97f4a7c15; +// x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9; +// x = (x ^ (x >> 27)) * 0x94d049bb133111eb; +// return x ^ (x >> 31); +// } +// static unsigned hash_combine(unsigned a, unsigned b) { return a * 31 + b; } +// int operator()(int x) const { return hash_f(x)^RANDOM; } +// }; + +signed main() { + quickie + test + while(t--) { + int n ; + cin >> n ; + set ans ; + string temp = "" ; + for(int i=0; i