Submission #91699

#TimeUsernameProblemLanguageResultExecution timeMemory
91699SamAndHyper-minimum (IZhO11_hyper)C++17
100 / 100
694 ms44080 KiB
#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)

hyper.cpp: In function 'int main()':
hyper.cpp:14:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d%d", &n, &m);
     ~~~~~^~~~~~~~~~~~~~~~
hyper.cpp:23:26: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
                     scanf("%d", &a[i][j][k][l]);
                     ~~~~~^~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...