#include<bits/stdc++.h>
#define f(i, n) for(int i = 0; i < n; i++)
using namespace std;
int x[35][35][35][35];
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
int n, m;
cin >> n >> m;
f(i, n) f(i1, n) f(i2, n) f(i3, n) cin >> x[i][i1][i2][i3];
f(i, n) f(i1, n) f(i2, n) f(i3, n - m + 1) f(X, m) x[i][i1][i2][i3] = min(x[i][i1][i2][i3], x[i][i1][i2][i3 + X]);
f(i, n) f(i1, n) f(i2, n - m + 1) f(i3, n) f(X, m) x[i][i1][i2][i3] = min(x[i][i1][i2][i3], x[i][i1][i2 + X][i3]);
f(i, n) f(i1, n - m + 1) f(i2, n) f(i3, n) f(X, m) x[i][i1][i2][i3] = min(x[i][i1][i2][i3], x[i][i1 + X][i2][i3]);
f(i, n - m + 1) f(i1, n) f(i2, n) f(i3, n) f(X, m) x[i][i1][i2][i3] = min(x[i][i1][i2][i3], x[i + X][i1][i2][i3]);
f(i, n - m + 1) f(i1, n - m + 1) f(i2, n - m + 1) f(i3, n - m + 1) cout << x[i][i1][i2][i3] << ' ';
cout << '\n';
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Correct |
1 ms |
2520 KB |
Output is correct |
3 |
Correct |
3 ms |
2640 KB |
Output is correct |
4 |
Correct |
2 ms |
2640 KB |
Output is correct |
5 |
Correct |
3 ms |
2640 KB |
Output is correct |
6 |
Correct |
7 ms |
5200 KB |
Output is correct |
7 |
Correct |
6 ms |
5112 KB |
Output is correct |
8 |
Correct |
15 ms |
6224 KB |
Output is correct |
9 |
Correct |
24 ms |
7760 KB |
Output is correct |
10 |
Correct |
18 ms |
6236 KB |
Output is correct |
11 |
Correct |
44 ms |
9284 KB |
Output is correct |
12 |
Correct |
95 ms |
14664 KB |
Output is correct |
13 |
Correct |
82 ms |
13384 KB |
Output is correct |
14 |
Correct |
132 ms |
19316 KB |
Output is correct |
15 |
Correct |
176 ms |
29480 KB |
Output is correct |
16 |
Correct |
122 ms |
17992 KB |
Output is correct |
17 |
Correct |
133 ms |
19324 KB |
Output is correct |
18 |
Correct |
217 ms |
34636 KB |
Output is correct |
19 |
Correct |
166 ms |
23532 KB |
Output is correct |
20 |
Correct |
133 ms |
21488 KB |
Output is correct |