#include "bits/stdc++.h"
using namespace std;
const int N = 35;
int n, m;
int a[N][N][N][N];
void solve() {
cin >> n >> m;
assert(n <= N);
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
for (int x = 0; x < n; x++) {
for (int y = 0; y < n; y++) {
cin >> a[i][j][x][y];
}
}
}
}
for (int i = 0; i + m <= n; i++) {
for (int j = 0; j + m <= n; j++) {
for (int x = 0; x + m <= n; x++) {
for (int y = 0; y + m <= n; y++) {
int ans = a[i][j][x][y];
for (int i2 = 0; i2 < m; i2++) for (int j2 = 0; j2 < m; j2++) {
for (int x2 = 0; x2 < m; x2++) for (int y2 = 0; y2 < m; y2++) {
ans = min(ans, a[i + i2][j + j2][x + x2][y + y2]);
}
}
cout << ans << " ";
}
}
}
}
}
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int t = 1;
// cin >> t;
while (t--) {
solve();
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Correct |
1 ms |
2552 KB |
Output is correct |
3 |
Correct |
3 ms |
2640 KB |
Output is correct |
4 |
Correct |
3 ms |
2680 KB |
Output is correct |
5 |
Correct |
2 ms |
2640 KB |
Output is correct |
6 |
Correct |
13 ms |
5284 KB |
Output is correct |
7 |
Correct |
19 ms |
4956 KB |
Output is correct |
8 |
Correct |
21 ms |
6224 KB |
Output is correct |
9 |
Correct |
31 ms |
7752 KB |
Output is correct |
10 |
Correct |
112 ms |
6300 KB |
Output is correct |
11 |
Correct |
496 ms |
9152 KB |
Output is correct |
12 |
Execution timed out |
2068 ms |
14408 KB |
Time limit exceeded |
13 |
Halted |
0 ms |
0 KB |
- |