Submission #17692

#TimeUsernameProblemLanguageResultExecution timeMemory
17692chromeHyper-minimum (IZhO11_hyper)C++98
95 / 100
2000 ms33756 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long #define foreach(it, S) for (__typeof (S.begin()) it = S.begin(); it != S.end(); it++) #define all(x) x.begin(), x.end() #define endl '\n' #define _ ios_base :: sync_with_stdio(false); cin.tie(NULL); #ifdef inputf #define fname "" #else #define fname "" // <- Here #endif const double eps = 1e-9; const int MaxN = int(2e5) + 256; const int MOD = int(1e9) + 7; template <typename T> inline T gcd(T a, T b) { return b ? gcd (b, a % b) : a; } inline bool Palindrome(const string& s) { return equal(s.begin(), s.end(), s.rbegin()); } int x[45][45][45][45]; int y[45][45][45][45]; int main() { // _ #ifdef lcl freopen(fname".in", "r", stdin); freopen(fname".out", "w", stdout); #endif int n, m; 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) y[i][j][k][l] = INT_MAX; 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", &x[i][j][k][l]); int val = x[i][j][k][l]; for (int p = 0, q = l; p < m && q > 0; ++p, --q) { #define S(x, val) x = min(x, val) S(y[i][j][k][q], val); #undef S } } for (int i1 = 1; i1 <= n - m + 1; ++i1) for (int i2 = 1; i2 <= n - m + 1; ++i2) for (int i3 = 1; i3 <= n - m + 1; ++i3) for (int i4 = 1; i4 <= n - m + 1; ++i4) { int val = INT_MAX; for (int j1 = i1; j1 <= i1 + m - 1; ++j1) for (int j2 = i2; j2 <= i2 + m - 1; ++j2) for (int j3 = i3; j3 <= i3 + m - 1; ++j3) val = min(val, y[j1][j2][j3][i4]); /* for (int j4 = i4; j4 <= i4 + m - 1; ++j4) { val = min(val, x[j1][j2][j3][j4]); } */ printf("%d ", val); } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...