Submission #914964

#TimeUsernameProblemLanguageResultExecution timeMemory
914964adaawfHyper-minimum (IZhO11_hyper)C++17
100 / 100
225 ms61356 KiB
#include <iostream> using namespace std; int a[36][36][36][36], b[36][36][36][36], f[36][36][36][36], c[36][36][36][36], g[36][36][36][36]; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n, m; cin >> n >> m; for (int i = 1; i <= n; i++) { for (int j = 1; j <= n; j++) { for (int k = 1; k <= n; k++) { for (int l = 1; l <= n; l++) { cin >> a[i][j][k][l]; } } } } for (int i = 1; i <= n; i++) { for (int j = 1; j <= n; j++) { for (int k = 1; k <= n; k++) { for (int l = 1; l <= n - m + 1; l++) { b[i][j][k][l] = 1e9; for (int u = l; u < l + m; u++) { b[i][j][k][l] = min(b[i][j][k][l], a[i][j][k][u]); } } } } } for (int i = 1; i <= n; i++) { for (int j = 1; j <= n; j++) { for (int k = 1; k <= n - m + 1; k++) { for (int l = 1; l <= n - m + 1; l++) { f[i][j][k][l] = 1e9; for (int u = k; u < k + m; u++) { f[i][j][k][l] = min(f[i][j][k][l], b[i][j][u][l]); } } } } } for (int i = 1; i <= n; i++) { for (int j = 1; j <= n - m + 1; j++) { for (int k = 1; k <= n - m + 1; k++) { for (int l = 1; l <= n - m + 1; l++) { c[i][j][k][l] = 1e9; for (int u = j; u < j + m; u++) { c[i][j][k][l] = min(c[i][j][k][l], f[i][u][k][l]); } } } } } for (int i = 1; i <= n - m + 1; i++) { for (int j = 1; j <= n - m + 1; j++) { for (int k = 1; k <= n - m + 1; k++) { for (int l = 1; l <= n - m + 1; l++) { g[i][j][k][l] = 1e9; for (int u = i; u < i + m; u++) { g[i][j][k][l] = min(g[i][j][k][l], c[u][j][k][l]); } cout << g[i][j][k][l] << " "; } } } } }
#Verdict Execution timeMemoryGrader output
Fetching results...