diff --git a/YODANESS.cpp b/YODANESS.cpp new file mode 100644 index 0000000..bcfa814 --- /dev/null +++ b/YODANESS.cpp @@ -0,0 +1,51 @@ +// Problem : YODANESS from SPOJ + +#include +using namespace std; + +void update(int BIT[], int v, int n){ + for(;v<=n;v+=(v&(-v)))BIT[v]++; +} + +int query(int BIT[], int v){ + int ans = 0; + for(;v>0;v-=(v&(-v)))ans+=BIT[v]; + return ans; +} + +void solve(){ + int n,i; + string s; + unordered_map Hash; + cin>>n; + int a[n]; + + for(i=0;i>s; + Hash[s] = i+1; + } + + for(i=0;i>s; + a[i] = Hash[s]; + } + + int BIT[n+1],res; + for(i=1;i<=n;i++)BIT[i] = 0; + + res = 0; + + for(i=0;i>t; + while(t--)solve(); +} \ No newline at end of file