Submission #1091715

#TimeUsernameProblemLanguageResultExecution timeMemory
1091715KluydQHyper-minimum (IZhO11_hyper)C++17
100 / 100
533 ms41320 KiB
#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 timeMemoryGrader output
Fetching results...