Mock CCC '21 S3 - Lexicographically Smallest Permutation Subsequence
View as PDF        
            Submit solution
        
    
    
    
        
        
    
    
            
    
    
    
        
                
        
        Points:
        
                10 (partial)        
    
    
        Time limit:
        0.1s
    
    
                Java
                0.25s
            
            
                Python 3
                0.5s
            
    
        Memory limit:
        1G
    
    
                    Problem type                
                
        Given a list of  positive integers, none larger than 
, compute
the lexicographically smallest permutation of the first 
 positive integers
that is a subsequence of the list.
Constraints
Each integer from  to 
 appears at least once in the list.
Input Specification
The first line contains two space-separated integers  and 
. Each of the
next 
 lines contains a single integer, the integers of the list in order.
Output Specification
Output  space-separated integers, the lexicographically smallest permutation
that is a subsequence.
Sample Input
6 3
3
2
1
3
1
3
Sample Output
2 1 3
Comments
Can I ask why I am getting presentation error?
you have to remove trailing spaces and end with a newline