#include "bits/stdc++.h"
#define ll long long
using namespace std;
const int sz = 40;
int a[sz][sz][sz][sz];
int main() {
int n, m;
cin >> n >> m;
for (int i = 0; i < n; i ++)
for (int j = 0; j < n; j ++)
for (int k = 0; k < n; k ++)
for (int l = 0; l < n; l ++)
cin >> a[i][j][k][l];
for (int i = 0; i < n; i ++)
for (int j = 0; j < n; j ++)
for (int k = 0; k < n; k ++)
for (int l = 0; l <= n - m; l ++)
for (int o = 0; o <= m - 1; o ++)
a[i][j][k][l] = min(a[i][j][k][l], a[i][j][k][l + o]);
for (int i = 0; i < n; i ++)
for (int j = 0; j < n; j ++)
for (int k = 0; k <= n - m; k ++)
for (int l = 0; l < n; l ++)
for (int o = 0; o <= m - 1; o ++)
a[i][j][k][l] = min(a[i][j][k][l], a[i][j][k + o][l]);
for (int i = 0; i < n; i ++)
for (int j = 0; j <= n - m; j ++)
for (int k = 0; k < n; k ++)
for (int l = 0; l < n; l ++)
for (int o = 0; o <= m - 1; o ++)
a[i][j][k][l] = min(a[i][j][k][l], a[i][j + o][k][l]);
for (int i = 0; i <= n - m; i ++)
for (int j = 0; j < n; j ++)
for (int k = 0; k < n; k ++)
for (int l = 0; l < n; l ++)
for (int o = 0; o <= m - 1; o ++)
a[i][j][k][l] = min(a[i][j][k][l], a[i + o][j][k][l]);
for (int i = 0; i <= n - m; i ++)
for (int j = 0; j <= n - m; j ++)
for (int k = 0; k <= n - m; k ++)
for (int l = 0; l <= n - m; l ++)
cout << a[i][j][k][l] << ' ';
cout << '\n';
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
2396 KB |
Output is correct |
3 |
Correct |
3 ms |
4696 KB |
Output is correct |
4 |
Correct |
3 ms |
4688 KB |
Output is correct |
5 |
Correct |
3 ms |
4700 KB |
Output is correct |
6 |
Correct |
15 ms |
5140 KB |
Output is correct |
7 |
Correct |
14 ms |
4956 KB |
Output is correct |
8 |
Correct |
56 ms |
8228 KB |
Output is correct |
9 |
Correct |
56 ms |
9812 KB |
Output is correct |
10 |
Correct |
49 ms |
8224 KB |
Output is correct |
11 |
Correct |
110 ms |
11352 KB |
Output is correct |
12 |
Correct |
232 ms |
18124 KB |
Output is correct |
13 |
Correct |
220 ms |
16980 KB |
Output is correct |
14 |
Correct |
251 ms |
22736 KB |
Output is correct |
15 |
Correct |
395 ms |
32340 KB |
Output is correct |
16 |
Correct |
319 ms |
20820 KB |
Output is correct |
17 |
Correct |
337 ms |
22140 KB |
Output is correct |
18 |
Correct |
455 ms |
37452 KB |
Output is correct |
19 |
Correct |
416 ms |
26448 KB |
Output is correct |
20 |
Correct |
398 ms |
24400 KB |
Output is correct |