Submission #585481

# Submission time Handle Problem Language Result Execution time Memory
585481 2022-06-29T02:27:27 Z Shin Hyper-minimum (IZhO11_hyper) C++14
0 / 100
42 ms 7308 KB
#include <bits/stdc++.h>
#define fi first
#define se second
#define mp make_pair
#define all(x) x.begin(), x.end()

using namespace std;
template <class X, class Y> bool minimize(X &a, Y b) {
    if (a > b) return a = b, true;
    return false;
}
template <class X, class Y> bool maximize(X &a, Y b) {
    if (a < b) return a = b, true;
    return false;
}

int a[25][25][25][25];
signed main() {
  cin.tie(0)->sync_with_stdio(0);
  int n, m; cin >> n >> m;
  for (int i = 1; i <= n; i ++) {
    for (int j = 1; j <= n; j ++) {
      for (int ii = 1; ii <= n; ii ++) {
        for (int jj = 1; jj <= n; jj ++) {
          cin >> a[i][j][ii][jj];
        }
      }
    }
  }
  for (int i = 1; i <= n; i ++) {
    for (int j = 1; j <= n; j ++) {
      for (int ii = 1; ii <= n; ii ++) {
        for (int jj = 1; jj <= n; jj ++) {
          for (int k = 1; k < m; k ++) {
            if (jj + k > n) break;
            minimize(a[i][j][ii][jj], a[i][j][ii][jj + k]);
          }
        }
      }
      for (int ii = 1; ii <= n; ii ++) {
        for (int jj = 1; jj <= n; jj ++) {
          for (int k = 1; k < m; k ++) {
            if (ii + k > n) break;
            minimize(a[i][j][ii][jj], a[i][j][ii + k][jj]);
          }
        }
      }
    }
    for (int j = 1; j <= n; j ++) {
      for (int ii = 1; ii <= n; ii ++) {
        for (int jj = 1; jj <= n; jj ++) {
          for (int k = 1; k < m; k ++) {
            if (j + k > n) break;
            minimize(a[i][j][ii][jj], a[i][j + k][ii][jj]);
          }
        }
      }
    }
  }
  for (int i = 1; i <= n; i ++) {
    for (int j = 1; j <= n; j ++) {
      for (int ii = 1; ii <= n; ii ++) {
        for (int jj = 1; jj <= n; jj ++) {
          for (int k = 1; k < m; k ++) {
            if (k + i > n) break;
            minimize(a[i][j][ii][jj], a[i + k][j][ii][jj]);
          }
        }
      }
    }
  }
  for (int i = 1; i + m - 1 <= n; i ++) {
    for (int j = 1; j + m - 1 <= n; j ++) {
      for (int ii = 1; ii + m - 1 <= n; ii ++) {
        for (int jj = 1; jj + m - 1 <= n; jj ++) {
          cout << a[i][j][ii][jj] << " ";
        }
      }
    }
  }
  return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 3 ms 596 KB Output is correct
4 Correct 2 ms 592 KB Output is correct
5 Correct 2 ms 724 KB Output is correct
6 Correct 10 ms 1492 KB Output is correct
7 Correct 11 ms 1364 KB Output is correct
8 Correct 32 ms 2892 KB Output is correct
9 Correct 42 ms 4660 KB Output is correct
10 Correct 31 ms 2948 KB Output is correct
11 Runtime error 42 ms 7308 KB Execution killed with signal 11
12 Halted 0 ms 0 KB -