#include <bits/stdc++.h>
#define pb push_back
#define endl "\n"
#define mp make_pair
#define fi first
#define se second
#define all(x) x.begin(), x.end()
#define fname ""
#define sz(x) (int)(x.size())
typedef long long ll;
using namespace std;
const ll N = (ll)(5e5) + 322;
const ll INF = (ll)(1e9);
const ll mod = (ll)(1e9) + 7;
const double eps = 1e-9;
int n, m, sz, a[40][40][40][40], sm, d[40][40][40][40];
int getmn(int I, int J, int K, int Q) {
int res = INF;
for (int i = I; i <= I + m - 1; ++i) {
for (int j = J; j <= J + m - 1; ++j) {
for (int k = K; k <= K + m - 1; ++k) {
for (int q = Q; q <= Q + m - 1; ++q) {
res = min(a[i][j][k][q], res);
}
}
}
}
return res;
}
int main () {
//freopen(fname".in", "r", stdin);
//freopen(fname".out", "w", stdout);
scanf("%d%d", &n, &m);
if (n > 35) {
cout << "qwe";
return 0;
}
for (int i = 1; i <= n; ++i) {
for (int j = 1; j <= n; ++j) {
for (int k = 1; k <= n; ++k) {
for (int q = 1; q <= n; ++q) {
scanf("%d", &a[i][j][k][q]);
}
}
}
}
sm = n - m + 1;
for (int i = 1; i <= sm; ++i) {
for (int j = 1; j <= sm; ++j) {
for (int k = 1; k <= sm; ++k) {
for (int q = 1; q <= sm; ++q) {
d[i][j][k][q] = getmn(i, j, k, q);
}
}
}
}
for (int i = 1; i <= sm; ++i) {
for (int j = 1; j <= sm; ++j) {
for (int k = 1; k <= sm; ++k) {
for (int q = 1; q <= sm; ++q) {
printf("%d ", d[i][j][k][q]);
}
}
}
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
21720 KB |
Output is correct |
2 |
Correct |
0 ms |
21720 KB |
Output is correct |
3 |
Correct |
0 ms |
21720 KB |
Output is correct |
4 |
Correct |
5 ms |
21720 KB |
Output is correct |
5 |
Correct |
0 ms |
21720 KB |
Output is correct |
6 |
Correct |
20 ms |
21720 KB |
Output is correct |
7 |
Correct |
35 ms |
21720 KB |
Output is correct |
8 |
Correct |
52 ms |
21720 KB |
Output is correct |
9 |
Correct |
37 ms |
21720 KB |
Output is correct |
10 |
Correct |
225 ms |
21720 KB |
Output is correct |
11 |
Correct |
1158 ms |
21720 KB |
Output is correct |
12 |
Execution timed out |
2000 ms |
21716 KB |
Program timed out |
13 |
Correct |
209 ms |
21720 KB |
Output is correct |
14 |
Correct |
451 ms |
21720 KB |
Output is correct |
15 |
Correct |
371 ms |
21720 KB |
Output is correct |
16 |
Correct |
1358 ms |
21720 KB |
Output is correct |
17 |
Execution timed out |
2000 ms |
21716 KB |
Program timed out |
18 |
Correct |
584 ms |
21720 KB |
Output is correct |
19 |
Execution timed out |
2000 ms |
21716 KB |
Program timed out |
20 |
Correct |
432 ms |
21720 KB |
Output is correct |