#include <bits/stdc++.h>
#define forn(i, n) for(int i = 0; i < n; i++)
using namespace std;
int a[35][35][35][35];
int b[35][35][35][35];
int main(){
cin.tie(0); cout.tie(0)->sync_with_stdio(false);
int n, m; cin >> n >> m;
forn(x, n) forn(y, n) forn(z, n) forn(t, n) cin >> a[x][y][z][t];
forn(x, n) forn(y, n) forn(z, n) forn(t, n - m + 1) forn(t2, m) a[x][y][z][t] = min(a[x][y][z][t], a[x][y][z][t + t2]);
forn(x, n) forn(y, n) forn(z, n - m + 1) forn(t, n) forn(z2, m) a[x][y][z][t] = min(a[x][y][z][t], a[x][y][z + z2][t]);
forn(x, n) forn(y, n - m + 1) forn(z, n) forn(t, n) forn(y2, m) a[x][y][z][t] = min(a[x][y][z][t], a[x][y + y2][z][t]);
forn(x, n - m + 1) forn(y, n) forn(z, n) forn(t, n) forn(x2, m) a[x][y][z][t] = min(a[x][y][z][t], a[x + x2][y][z][t]);
forn(x, n - m + 1) forn(y, n - m + 1) forn(z, n - m + 1) forn(t, n - m + 1) cout << a[x][y][z][t] << ' ';
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
2 ms |
856 KB |
Output is correct |
4 |
Correct |
2 ms |
852 KB |
Output is correct |
5 |
Correct |
2 ms |
856 KB |
Output is correct |
6 |
Correct |
10 ms |
2084 KB |
Output is correct |
7 |
Correct |
7 ms |
1868 KB |
Output is correct |
8 |
Correct |
19 ms |
3840 KB |
Output is correct |
9 |
Correct |
32 ms |
5476 KB |
Output is correct |
10 |
Correct |
20 ms |
3904 KB |
Output is correct |
11 |
Correct |
54 ms |
8056 KB |
Output is correct |
12 |
Correct |
111 ms |
14036 KB |
Output is correct |
13 |
Correct |
92 ms |
12916 KB |
Output is correct |
14 |
Correct |
136 ms |
18760 KB |
Output is correct |
15 |
Correct |
214 ms |
29324 KB |
Output is correct |
16 |
Correct |
147 ms |
17740 KB |
Output is correct |
17 |
Correct |
171 ms |
19224 KB |
Output is correct |
18 |
Correct |
264 ms |
34608 KB |
Output is correct |
19 |
Correct |
215 ms |
23620 KB |
Output is correct |
20 |
Correct |
163 ms |
21560 KB |
Output is correct |