# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
521679 | Kalashnikov | Hyper-minimum (IZhO11_hyper) | C++17 | 282 ms | 23504 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 ios ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define file(s) if (fopen(s".in", "r")) freopen(s".in", "r", stdin), freopen(s".out", "w", stdout)
#define all(a) a.begin() , a.end()
#define F first
#define S second
using namespace std;
using ll = long long;
const int N = 35 , inf = 2e9 + 7;
const ll INF = 1e18 , mod = 1e9+7 , P = 6547;
int a[N][N][N][N][2];
int n , m;
void solve(int tc) {
cin >> 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 ++) {
cin >> a[i][j][k][l][1];
}
}
}
}
for(int h = 2; h <= m; h ++) {
for(int i = 1; i <= n-h+1; i ++) {
for(int j = 1; j <= n-h+1; j ++) {
for(int k = 1; k <= n-h+1; k ++) {
for(int l = 1; l <= n-h+1; l ++) {
a[i][j][k][l][h%2] = inf;
for(int p1: {0 , 1}) {
for(int p2: {0 , 1}) {
for(int p3: {0 , 1}) {
for(int p4: {0 , 1}) {
a[i][j][k][l][h%2] = min(a[i][j][k][l][h%2] , a[i+p1][j+p2][k+p3][l+p4][h%2^1]);
}
}
}
}
}
}
}
}
}
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 ++) {
cout << a[i][j][k][l][m%2] << ' ';
}
}
}
}
}
/*
*/
main() {
ios;
int tt = 1 , tc = 0;
// cin >> tt;
while(tt --) {
solve(++tc);
}
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |