크기 M인 N개의 벡터에 범위 갱신으로 값을 채운 뒤, 벡터들을 사전순으로 정렬한 안정적인 최소 순열을 출력한다.
어려움8정렬구현아직 제출이 없습니다시간 제한5초메모리 제한768 MBSeokhwan is a cute 4-year-old baby. His teacher, Suryal, is teaching some knowledge suited for babies. Suryal brought a big whiteboard, which is essentially N empty vectors (vectors filled with zeroes) of size M, denoted by V_1,V_2,⋯,V_N.
Yesterday, Seokhwan learned how to write numbers. To test his ability, Suryal gave Q queries to Seokhwan. For each query, Seokhwan is given four number S,E,P,X. For all vectors V_S,V_S+1,⋯,V_E, Seokhwan should write X to P-th element of each vectors. It’s guaranteed that Seokhwan never overwrites (he never writes in a place where he already wrote something).
Today, Seokhwan learned how to sort a sequence in O(NlogN) time complexity. To test his ability, Seokhwan should sort the vectors. Formally, Seokhwan should find a size-N permutation P_1,P_2,⋯,P_N where V_P_i≤V_P_i+1 for all 1≤i<N. Suryal expects Seokhwan to do stable sort, thus if there are many such P, then you should print the one which is lexicographically minimum.
Seokhwan did all those tasks in 8000ms, which Suryal don’t know how. You should help Suryal, and do what Seokhwan did. For two sequence L,R of same size, R is lexicographically greater than L if and only if there exists some j∈\[1,M] such that L_i=R_i for all 1≤i<j and L_j<R_j.
The first line contains the number of vector N, size of each vector M, and number of queries Q.
In next Q lines, four integer S,E,P,X is given. This indicates that for all vectors V_S,V_S+1,⋯,V_E, Seokhwan should write X to P-th element of each vector.
In i-th line, print the i-th element of permutation, which is the lexicographically minimum permutation which V_P_i≤V_P_i+1 holds.
For each query, the following constraints are satisfied: