Submission #1091715

# Submission time Handle Problem Language Result Execution time Memory
1091715 2024-09-21T22:39:05 Z KluydQ Hyper-minimum (IZhO11_hyper) C++17
100 / 100
533 ms 41320 KB
#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
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 604 KB Output is correct
3 Correct 3 ms 1372 KB Output is correct
4 Correct 3 ms 1468 KB Output is correct
5 Correct 4 ms 1372 KB Output is correct
6 Correct 16 ms 3300 KB Output is correct
7 Correct 16 ms 3160 KB Output is correct
8 Correct 46 ms 5972 KB Output is correct
9 Correct 56 ms 7824 KB Output is correct
10 Correct 51 ms 6224 KB Output is correct
11 Correct 122 ms 11604 KB Output is correct
12 Correct 276 ms 19168 KB Output is correct
13 Correct 219 ms 17996 KB Output is correct
14 Correct 257 ms 23700 KB Output is correct
15 Correct 419 ms 35264 KB Output is correct
16 Correct 366 ms 23636 KB Output is correct
17 Correct 398 ms 25128 KB Output is correct
18 Correct 480 ms 41320 KB Output is correct
19 Correct 533 ms 30568 KB Output is correct
20 Correct 447 ms 28312 KB Output is correct