답안 #91699

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
91699 2018-12-29T09:04:49 Z SamAnd 최솟값 배열 (IZhO11_hyper) C++17
100 / 100
694 ms 44080 KB
#include <bits/stdc++.h>
using namespace std;
const int N = 36;

int n, m;
int a[N][N][N][N];

int t[4][N][N][N][N];

int main()
{
    //freopen("B.in", "r", stdin);
    //freopen("B.out", "w", stdout);
    scanf("%d%d", &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)
                {
                    scanf("%d", &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)
            {
                multiset<int> s;
                for (int l = 1; l <= m; ++l)
                {
                    s.insert(a[i][j][k][l]);
                }
                for (int l = 1; l <= n - m + 1; ++l)
                {
                    t[3][i][j][k][l] = (*s.begin());
                    int r = l + m - 1;
                    s.erase(s.find(a[i][j][k][l]));
                    s.insert(a[i][j][k][r + 1]);
                }
            }
            for (int l = 1; l <= n - m + 1; ++l)
            {
                multiset<int> s;
                for (int k = 1; k <= m; ++k)
                {
                    s.insert(t[3][i][j][k][l]);
                }
                for (int k = 1; k <= n - m + 1; ++k)
                {
                    t[2][i][j][k][l] = (*s.begin());
                    int r = k + m - 1;
                    s.erase(s.find(t[3][i][j][k][l]));
                    s.insert(t[3][i][j][r + 1][l]);
                }
            }
        }
        for (int k = 1; k <= n - m + 1; ++k)
        {
            for (int l = 1; l <= n - m + 1; ++l)
            {
                multiset<int> s;
                for (int j = 1; j <= m; ++j)
                {
                    s.insert(t[2][i][j][k][l]);
                }
                for (int j = 1; j <= n - m + 1; ++j)
                {
                    t[1][i][j][k][l] = (*s.begin());
                    int r = j + m - 1;
                    s.erase(s.find(t[2][i][j][k][l]));
                    s.insert(t[2][i][r + 1][k][l]);
                }
            }
        }
    }
    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)
            {
                multiset<int> s;
                for (int i = 1; i <= m; ++i)
                {
                    s.insert(t[1][i][j][k][l]);
                }
                for (int i = 1; i <= n - m + 1; ++i)
                {
                    t[0][i][j][k][l] = (*s.begin());
                    int r = i + m - 1;
                    s.erase(s.find(t[1][i][j][k][l]));
                    s.insert(t[1][r + 1][j][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)
                {
                    printf("%d ", t[0][i][j][k][l]);
                }
            }
        }
    }
    return 0;
}

Compilation message

hyper.cpp: In function 'int main()':
hyper.cpp:14:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d%d", &n, &m);
     ~~~~~^~~~~~~~~~~~~~~~
hyper.cpp:23:26: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
                     scanf("%d", &a[i][j][k][l]);
                     ~~~~~^~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 760 KB Output is correct
3 Correct 6 ms 1756 KB Output is correct
4 Correct 7 ms 2296 KB Output is correct
5 Correct 7 ms 2680 KB Output is correct
6 Correct 24 ms 5368 KB Output is correct
7 Correct 20 ms 4344 KB Output is correct
8 Correct 47 ms 6492 KB Output is correct
9 Correct 80 ms 12316 KB Output is correct
10 Correct 58 ms 7672 KB Output is correct
11 Correct 165 ms 14172 KB Output is correct
12 Correct 329 ms 19912 KB Output is correct
13 Correct 216 ms 13628 KB Output is correct
14 Correct 376 ms 27996 KB Output is correct
15 Correct 543 ms 39332 KB Output is correct
16 Correct 336 ms 18152 KB Output is correct
17 Correct 470 ms 23832 KB Output is correct
18 Correct 694 ms 44080 KB Output is correct
19 Correct 618 ms 42872 KB Output is correct
20 Correct 409 ms 34140 KB Output is correct