# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1091715 | KluydQ | Hyper-minimum (IZhO11_hyper) | C++17 | 533 ms | 41320 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 FOR( i, x, n, d ) for( int i = x; i <= n; i += d )
using namespace std;
const int N = sqrt(sqrt(1500000)) + 2;
long long ans = 0;
int x[N][N][N][N], y[N][N][N][N], n, m;
void calc( int tp )
{
FOR( i, 1, n - m + 1 + ( tp == 4 ? 0 : m - 1 ), 1 )
{
FOR( j, 1, n - m + 1 + ( tp == 3 ? 0 : m - 1 ), 1 )
{
FOR( k, 1, n - m + 1 + ( tp == 2 ? 0 : m - 1 ), 1 )
{
FOR( l, 1, n - m + 1 + ( tp == 1 ? 0 : m - 1 ), 1 )
{
FOR( plus, 0, m - 1, 1 )
{
if( tp == 1 ) y[i][j][k][l] = min( y[i][j][k][l], y[i][j][k][l + plus] );
if( tp == 2 ) y[i][j][k][l] = min( y[i][j][k][l], y[i][j][k + plus][l] );
if( tp == 3 ) y[i][j][k][l] = min( y[i][j][k][l], y[i][j + plus][k][l] );
if( tp == 4 ) y[i][j][k][l] = min( y[i][j][k][l], y[i + plus][j][k][l] );
}
}
}
}
}
}
int main()
{
cin >> n >> m;
// N = 36
FOR( i, 1, n, 1 )
{
FOR( j, 1, n, 1 )
{
FOR( k, 1, n, 1 )
{
FOR( l, 1, n, 1 )
{
cin >> x[i][j][k][l];
y[i][j][k][l] = x[i][j][k][l];
}
}
}
}
FOR( i, 1, 4, 1 ) calc( i );
FOR( i, 1, n - m + 1, 1 )
{
FOR( j, 1, n - m + 1, 1 )
{
FOR( k, 1, n - m + 1, 1 )
{
FOR( l, 1, n - m + 1, 1 ) cout << y[i][j][k][l] << ' ';
}
}
}
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |