답안 #91698

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

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

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

int main()
{
    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:12: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:21: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 504 KB Output is correct
2 Correct 2 ms 760 KB Output is correct
3 Correct 5 ms 1912 KB Output is correct
4 Correct 7 ms 2296 KB Output is correct
5 Correct 7 ms 2680 KB Output is correct
6 Correct 25 ms 5752 KB Output is correct
7 Correct 20 ms 4728 KB Output is correct
8 Correct 48 ms 7928 KB Output is correct
9 Correct 82 ms 13436 KB Output is correct
10 Correct 58 ms 8924 KB Output is correct
11 Correct 165 ms 17460 KB Output is correct
12 Correct 328 ms 27128 KB Output is correct
13 Correct 215 ms 21496 KB Output is correct
14 Correct 377 ms 35148 KB Output is correct
15 Correct 540 ms 50040 KB Output is correct
16 Correct 342 ms 29480 KB Output is correct
17 Correct 470 ms 34808 KB Output is correct
18 Execution timed out 235 ms 21112 KB Time limit exceeded (wall clock)
19 Halted 0 ms 0 KB -