# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
880065 | heeheeheehaaw | Hyper-minimum (IZhO11_hyper) | C++17 | 541 ms | 182720 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 <iostream>
using namespace std;
int dp[36][36][36][36][36];
int a[36][36][36][36];
int main()
{
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], dp[1][i][j][k][l] = a[i][j][k][l];
for(int a = 2; a <= m; a++)
for(int i = 1; i <= n - a + 1; i++)
for(int j = 1; j <= n - a + 1; j++)
for(int k = 1; k <= n - a + 1; k++)
for(int l = 1; l <= n - a + 1; l++)
{
dp[a][i][j][k][l] = 1e9;
for(int i2 = i; i2 <= i + 1; i2++)
for(int j2 = j; j2 <= j + 1; j2++)
for(int k2 = k; k2 <= k + 1; k2++)
for(int l2 = l; l2 <= l + 1; l2++)
dp[a][i][j][k][l] = min(dp[a][i][j][k][l], dp[a - 1][i2][j2][k2][l2]);
}
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++)
cout<<dp[m][i][j][k][l]<<" ";
return 0;
}
/*
3 2
3 1 4 -4 0 4 0 0 -3 0 -2 -5 5 3 5 -4
4 -3 -5 -4 -4 5 -1 0 -3 -2 -1 2 -5 -5
-1 1 1 -4 3 5 3 -3 -3 3 0 1 4 -1 -2 3
-2 5 4 -1 -5 3 -4 0 -3 -1 3 -1 4 4 -1
-5 -3 4 -4 5 1 5 -4 3 2 2 -2 -2 4 2
-4 -3 1 3 1
*/
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |