#P13760. Clock Paradox
Clock Paradox
Background

(From a Phigros illustration, please contact for removal.)
Problem Description
Given a sequence , consider intervals such that every number from to appears exactly once within this interval (i.e., all elements in the subarray are pairwise distinct). Suppose there are intervals that satisfy this requirement, numbered from to .
Compute:
Output the answer modulo .
Input Format
The first line contains a positive integer , the length of the sequence.
The second line contains non-negative integers, representing the sequence .
Output Format
Output one non-negative integer, the value of the answer modulo .
6
1 2 3 3 2 1
40
13
1 1 4 5 1 4 1 9 1 9 8 1 0
239
10
5 4 3 2 5 6 1 3 1 4
315
Hint
Constraints
| Test Point ID | Special Property | ||
|---|---|---|---|
| A | |||
| B | |||
Special Property A: all are equal.
Special Property B: all are pairwise distinct.
For of the testdata, and .
Translated by ChatGPT 5