# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
91699 | SamAnd | Hyper-minimum (IZhO11_hyper) | C++17 | 694 ms | 44080 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>
using namespace std;
const int N = 36;
int n, m;
int a[N][N][N][N];
int t[4][N][N][N][N];
int main()
{
//freopen("B.in", "r", stdin);
//freopen("B.out", "w", stdout);
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 (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |