# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
585484 | Shin | Hyper-minimum (IZhO11_hyper) | C++14 | 462 ms | 37324 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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;
}
signed main() {
cin.tie(0)->sync_with_stdio(0);
int n, m; cin >> n >> m;
vector<vector<vector<vector<int>>>> a(n + 1, vector<vector<vector<int>>>(n + 1, vector<vector<int>>(n + 1, vector<int>(n + 1))));
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 |
---|---|---|---|---|
Fetching results... |