Need help counting number of subpermutations

Revision en2, by hphucvn, 2025-04-10 14:01:15

In original problem 1175F - The Number of Subpermutations, it is required to count the number of subpermutations that consist number from 1 to r — l + 1, each appear exactly once

I managed to solve it using two pointers, expanding from position i whereas a[i] = 1

How do I count number of subpermutations, starting from x to x + r — l, for example : [1, 3, 2] and [2, 4, 3] also counts. Also, it would be great if someone can find the submission link for this problem. Thanks for helping me.

Tags array, math

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English hphucvn 2025-04-10 14:01:15 2
en1 English hphucvn 2025-04-10 13:54:57 536 Initial revision (published)