Photos
Time limit2sMemory limit1024 MB
Given a numbered list of photo file names and a list of intervals of photo numbers, output the file names in each interval in order.
- Level
Easy2 of 10
- Topics
- Array, Implementation
- Solved
- No attempts yet
Input
Sergei is into digital photography. He recently decided to print some of his pictures and hang them on the wall in his hallway. He wrote down the file names of all the photos and numbered them in the order they appear in the list.
After that, Sergei spent several hours picking his favorite shots. He usually liked several photos in a row, so he wrote down the number of the first and the last one in each run. The result was a list of intervals of photo numbers that he liked.
Now Sergei wants a list of the file names of all the photos he liked. The list must first contain the file names of the photos in the first interval in increasing order of their numbers, then those of the second interval, and so on.
The list can be very large, so Sergei asks you to help him.