# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
17698 | Elibay | Hyper-minimum (IZhO11_hyper) | C++98 | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#define Fname "triangles"
using namespace std;
int a[40][40][40][40], x[40][40][40][40], n, m, i1, i2, i3, i4, j1, j2, j3, j4;
int main ()
{
#ifdef Elibay
freopen (".in", "r", stdin);
#endif
scanf ("%d%d", &n, &m);
for (i1 = 1; i1 <= n - m + 1; ++ i1)
for (i2 = 1; i2 <= n - m + 1; ++ i2)
for (i3 = 1; i3 <= n - m + 1; ++ i3)
for (i4 = 1; i4 <= n - m + 1; ++ i4)
scanf ("%d", &a[i1][i2][i3][i4]),
x[i1][i2][i3][i4] = a[i1][i2][i3][i4];
int w = n - m + 1;
for (i1 = 1; i1 <= w; ++ i1)
for (i2 = 1; i2 <= w; ++ i2)
for (i3 = 1; i3 <= w; ++ i3)
for (i4 = 1; i4 <= w; ++ i4)
for (j1 = i1; j1 <= i1 + m - 1; ++ j1)
for (j2 = i2; j2 <= i2 + m - 1; ++ j2)
for (j3 = i3; j3 <= i3 + m - 1; ++ j3)
for (j4 = i4; j4 <= i4 + m - 1; ++ j4)
x[i1][i2][i3][i4] = min (x[i1][i2][i3][i4], a[j1][j2][j3][j4]);
for (i1 = 1; i1 <= w; ++ i1)
for (i2 = 1; i2 <= w; ++ i2)
for (i3 = 1; i3 <= w; ++ i3)
for (i4 = 1; i4 <= w; ++ i4)
printf ("%d ", x[i1][i2][i3][i4]);
return 0;
}