Submission #880065

# Submission time Handle Problem Language Result Execution time Memory
880065 2023-11-28T16:46:19 Z heeheeheehaaw Hyper-minimum (IZhO11_hyper) C++17
100 / 100
541 ms 182720 KB
#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
1 Correct 1 ms 4696 KB Output is correct
2 Correct 1 ms 8540 KB Output is correct
3 Correct 7 ms 31292 KB Output is correct
4 Correct 5 ms 19032 KB Output is correct
5 Correct 5 ms 14796 KB Output is correct
6 Correct 20 ms 25548 KB Output is correct
7 Correct 20 ms 41812 KB Output is correct
8 Correct 63 ms 77228 KB Output is correct
9 Correct 60 ms 13136 KB Output is correct
10 Correct 66 ms 65104 KB Output is correct
11 Correct 142 ms 65328 KB Output is correct
12 Correct 288 ms 91984 KB Output is correct
13 Correct 291 ms 146448 KB Output is correct
14 Correct 292 ms 43416 KB Output is correct
15 Correct 438 ms 38844 KB Output is correct
16 Correct 442 ms 162652 KB Output is correct
17 Correct 426 ms 106664 KB Output is correct
18 Correct 534 ms 50088 KB Output is correct
19 Correct 539 ms 113052 KB Output is correct
20 Correct 541 ms 182720 KB Output is correct