#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 |
2396 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
860 KB |
Output is correct |
4 |
Correct |
2 ms |
860 KB |
Output is correct |
5 |
Correct |
1 ms |
860 KB |
Output is correct |
6 |
Correct |
6 ms |
3932 KB |
Output is correct |
7 |
Correct |
5 ms |
1884 KB |
Output is correct |
8 |
Correct |
15 ms |
3932 KB |
Output is correct |
9 |
Correct |
24 ms |
5712 KB |
Output is correct |
10 |
Correct |
16 ms |
3932 KB |
Output is correct |
11 |
Correct |
41 ms |
8012 KB |
Output is correct |
12 |
Correct |
86 ms |
14152 KB |
Output is correct |
13 |
Correct |
71 ms |
12880 KB |
Output is correct |
14 |
Correct |
100 ms |
18772 KB |
Output is correct |
15 |
Correct |
164 ms |
29368 KB |
Output is correct |
16 |
Correct |
109 ms |
17740 KB |
Output is correct |
17 |
Correct |
147 ms |
19172 KB |
Output is correct |
18 |
Correct |
205 ms |
34616 KB |
Output is correct |
19 |
Correct |
166 ms |
23632 KB |
Output is correct |
20 |
Correct |
126 ms |
21588 KB |
Output is correct |