[BOJ 11831] Hyper-minimum

View as PDF

Submit solution

Points: 4
Time limit: 2.0s
Memory limit: 256M

Problem types
Allowed languages
Assembly, Awk, C, C++, Java, Pascal, Perl, Python, Sed, Text

There is a 4-dimensional array X, each index of which is in interval from 1 to N. Your task is to construct new 4-dimensional array Y , elements of which can be calculated using the next formula: Y [i1, i2, i3, i4] = min(X[j1, j2, j3, j4]), where 1 ≤ ik ≤ N − M + 1, ik ≤ jk ≤ ik + M − 1, and M is given.

입력 형식

First line of the input file contains N and M (1 ≤ M ≤ N). Next lines of the input file contain elements of array X. The number of elements will be not more than 1500000 and elements will be integers not exceeding 109 by absolute value. They are given in such order, that the array can be read using following pseudocode:</p>

for i = 1 to N:
    for j = 1 to N:
        for k = 1 to N:
            for l = 1 to N:
                read X[i, j, k, l]
## 출력 형식

Output array Y in the same format as the X was given.

예제 입력 1

1 1
1

예제 출력 1

1

예제 입력 2

3 2
3 1 4 -4 0 4 0 0 -3 0 -2 -5 5 3 5 -4 4 -3 -5 -4 -4 5 -1 0 -3 -2 -1 2 -5 -5 -1 1 1 -4 3 5 3 -3 -3 3 0 1 4 -1 -2 3 -2 5 4 -1 -5 3 -4 0 -3 -1 3 -1 4 4 -1 -5 -3 4 -4 5 1 5 -4 3 2 2 -2 -2 4 2 -4 -3 1 3 1

예제 출력 2

-5 -5 -4 -3 -5 -5 -4 -5 -5 -5 -5 -5 -4 -5 -4 -5

Comments

There are no comments at the moment.