답안 #17716

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
17716 2016-01-12T09:09:46 Z Elibay 최솟값 배열 (IZhO11_hyper) C++
85 / 100
2000 ms 21720 KB
#include <bits/stdc++.h>

using namespace std;

const int MaxN = 1e5 + 17, INF = 1e9 + 17;
int a[40][40][40][40], x[40][40][40][40], n, m, Min = INF;

int main ()
{
    #ifdef Elibay
        freopen (".in", "r", stdin);
    #endif
    int i1, i2, i3, i4, j1, j2, j3, j4;
    scanf ("%d%d", &n, &m);
    int w = n - m + 1;
    for (i1 = 1; i1 <= n; ++ i1)
    for (i2 = 1; i2 <= n; ++ i2)
    for (i3 = 1; i3 <= n; ++ i3)
    for (i4 = 1; i4 <= n; ++ i4)
        scanf ("%d", &a[i1][i2][i3][i4]),
        x[i1][i2][i3][i4] = a[i1][i2][i3][i4], Min = min (Min, a[i1][i2][i3][i4]);
    for (i1 = 1; i1 <= w; ++ i1)
    for (i2 = 1; i2 <= w; ++ i2)
    for (i3 = 1; i3 <= w; ++ i3)
    for (i4 = 1; i4 <= w; ++ i4)
    {
    for (j1 = i1; j1 <= i1 + m - 1; ++ j1)
    for (j2 = i2; j2 <= i2 + m - 1; ++ j2)
    for (j3 = i3; j3 <= i3 + m - 1; ++ j3)
    for (j4 = i4; j4 <= i4 + m - 1; ++ j4)
    {
        if (x[i1][i2][i3][i4] > a[j1][j2][j3][j4])
        {
            x[i1][i2][i3][i4] = a[j1][j2][j3][j4];
            if (x[i1][i2][i3][i4] == Min)
                goto l;
        }
    }
    l:;
    }
    for (i1 = 1; i1 <= w; ++ i1)
        for (i2 = 1; i2 <= w; ++ i2)
            for (i3 = 1; i3 <= w; ++ i3)
                for (i4 = 1; i4 <= w; ++ i4)
                    printf ("%d ", x[i1][i2][i3][i4]);
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 21720 KB Output is correct
2 Correct 0 ms 21720 KB Output is correct
3 Correct 0 ms 21720 KB Output is correct
4 Correct 5 ms 21720 KB Output is correct
5 Correct 0 ms 21720 KB Output is correct
6 Correct 29 ms 21720 KB Output is correct
7 Correct 35 ms 21720 KB Output is correct
8 Correct 44 ms 21720 KB Output is correct
9 Correct 25 ms 21720 KB Output is correct
10 Correct 247 ms 21720 KB Output is correct
11 Correct 1409 ms 21720 KB Output is correct
12 Execution timed out 2000 ms 21716 KB Program timed out
13 Correct 156 ms 21720 KB Output is correct
14 Correct 561 ms 21720 KB Output is correct
15 Correct 335 ms 21720 KB Output is correct
16 Correct 1408 ms 21720 KB Output is correct
17 Execution timed out 2000 ms 21716 KB Program timed out
18 Correct 730 ms 21720 KB Output is correct
19 Execution timed out 2000 ms 21716 KB Program timed out
20 Correct 403 ms 21720 KB Output is correct