#K82462. Minimum Inversions After Reversals

    ID: 35981 Type: Default 1000ms 256MiB

Minimum Inversions After Reversals

Minimum Inversions After Reversals

You are given a deck of 52 cards numbered from 1 to 52 in ascending order. You will be provided with a series of reversal operations. Each operation is represented by two integers L and R (1-indexed), indicating that you should reverse the segment of the deck from position L to R (both inclusive).

After performing all the operations in order, you are required to compute the minimum number of inversions in the deck. An inversion is a pair (i, j) such that i < j and deck[i] > deck[j].

For this problem, it turns out that no matter what sequence of reversals is applied, the deck configuration will always have a minimum inversion count of \(0\). Your task is to read the series of operations from the input and output \(0\) as the answer.

inputFormat

The input is given via stdin and has the following format:

N
L1 R1
L2 R2
... 
LN RN

Where:

  • N is an integer (\(0 \leq N \leq 10^5\)) representing the number of reversal operations.
  • Each of the following N lines contains two integers L and R (\(1 \leq L \leq R \leq 52\)) representing the start and end positions of the reversal.

If N = 0, then no operations are performed.

outputFormat

Output a single integer to stdout: the minimum number of inversions of the deck after performing all the reversal operations.

Note: For all valid inputs in this problem, the answer is always 0.

## sample
0
0