Time Limit: 2 sec / Memory Limit: 1024 MB
L_1L1R_1R1L_2L2R_2R2
0 3 1 5
2
The part from X=0X=0 to X=3X=3 is painted red, and the part from X=1X=1 to X=5X=5 is painted blue.
Thus, the part from X=1X=1 to X=3X=3 is painted both red and blue, and its length is 22.