Can someone explain how to solve SEAINVS ? This is what I did :
Given two subarrays in the array, we need to find the number of permutations of the first subarray such that every element in it is smaller than the corresponding element in the second one. I sorted both the subarrays first, because finding the number of permutations of the first array with respect to any permutation of the second one would give the same answer. Then starting from the first position I just found out the number of ways that I can fill each position, and multiplied those to get the answer. But this is not fast enough for the large subtask.