답안 #880022

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
880022 2023-11-28T15:15:12 Z alexdd 최솟값 배열 (IZhO11_hyper) C++17
100 / 100
801 ms 253700 KB
#include<bits/stdc++.h>
//#pragma GCC optimize("O3,unroll-loops")
using namespace std;
int x[36][36][36][36];
int mnm[36][36][36][36][36];
int n,m;
signed main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);
    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>>x[i][j][k][l];
                    mnm[i][j][k][l][1] = x[i][j][k][l];
                }
            }
        }
    }
    for(int p=2;p<=m;p++)
    {
        for(int i=n-p+1;i>0;i--)
        {
            for(int j=n-p+1;j>0;j--)
            {
                for(int k=n-p+1;k>0;k--)
                {
                    for(int l=n-p+1;l>0;l--)
                    {
                        mnm[i][j][k][l][p] = mnm[i][j][k][l][p-1];
                        for(int mask=1;mask<(1<<4);mask++)
                        {
                            mnm[i][j][k][l][p] = min(mnm[i][j][k][l][p], mnm[i+(((1<<0)&mask)!=0)][j+(((1<<1)&mask)!=0)][k+(((1<<2)&mask)!=0)][l+(((1<<3)&mask)!=0)][p-1]);
                        }
                    }
                }
            }
        }
    }
    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<<mnm[i][j][k][l][m]<<" ";
                }
            }
        }
    }
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 4440 KB Output is correct
2 Correct 2 ms 14684 KB Output is correct
3 Correct 6 ms 41488 KB Output is correct
4 Correct 6 ms 41308 KB Output is correct
5 Correct 7 ms 41472 KB Output is correct
6 Correct 18 ms 72280 KB Output is correct
7 Correct 19 ms 72284 KB Output is correct
8 Correct 61 ms 113244 KB Output is correct
9 Correct 38 ms 114772 KB Output is correct
10 Correct 62 ms 113244 KB Output is correct
11 Correct 168 ms 171428 KB Output is correct
12 Correct 377 ms 204628 KB Output is correct
13 Correct 390 ms 203348 KB Output is correct
14 Correct 241 ms 209220 KB Output is correct
15 Correct 247 ms 236108 KB Output is correct
16 Correct 568 ms 224600 KB Output is correct
17 Correct 599 ms 225896 KB Output is correct
18 Correct 422 ms 253700 KB Output is correct
19 Correct 795 ms 239444 KB Output is correct
20 Correct 801 ms 237136 KB Output is correct