Plain Constructive Problem
InterviewTime limit1sMemory limit1024 MB
Given N and M intervals, build a sequence of length N with the largest K such that every interval contains all values 1 to K.
- Level
Easy3 of 10
- Topics
- Implementation, Math
- Solved
- No attempts yet
Problem
Given an integer and integer pairs , find the sequence that maximizes under the following conditions.
- consists of positive integers, each at most .
- For every pair , the subarray must contain every positive integer at most .
Input
The first line contains two integers and .
The next lines each contain two integers and .
Output
For a sequence that satisfies the conditions, print the integers .
If multiple answers exist, print any of them.