Submission #585481

#TimeUsernameProblemLanguageResultExecution timeMemory
585481ShinHyper-minimum (IZhO11_hyper)C++14
0 / 100
42 ms7308 KiB
#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 timeMemoryGrader output
Fetching results...