Submission #1108821

# Submission time Handle Problem Language Result Execution time Memory
1108821 2024-11-05T08:05:39 Z Tsagana Hyper-minimum (IZhO11_hyper) C++14
100 / 100
282 ms 32244 KB
#include<bits/stdc++.h>

#define IOS ios_base::sync_with_stdio(false);cin.tie();cout.tie();
#define all(x) x.begin(), x.end()
#define lnl long long
#define pq priority_queue
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define pb push_back
#define pp pop_back
#define F first
#define S second

using namespace std;

int antiloop = 0;

int n, m;
int X[37][37][37][37];
int Y[37][37][37][37];

void calc(int t) {
	for (int i = 1; i <= n-m+1 + (t == 4 ? 0 : m-1); i++) {
		for (int j = 1; j <= n-m+1 + (t == 3 ? 0 : m-1); j++) {
			for (int l = 1; l <= n-m+1 + (t == 2 ? 0 : m-1); l++) {
				for (int k = 1; k <= n-m+1 + (t == 1 ? 0 : m-1); k++) {
					for (int p = 0; p < m; p++) {
						if (t == 1) Y[i][j][l][k] = min(Y[i][j][l][k], Y[i][j][l][k+p]);
						if (t == 2) Y[i][j][l][k] = min(Y[i][j][l][k], Y[i][j][l+p][k]);
						if (t == 3) Y[i][j][l][k] = min(Y[i][j][l][k], Y[i][j+p][l][k]);
						if (t == 4) Y[i][j][l][k] = min(Y[i][j][l][k], Y[i+p][j][l][k]);
					}
				}
			}
		}
	}
}
void solve () {
	cin >> n >> m;

	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= n; j++) {
			for (int l = 1; l <= n; l++) {
				for (int k = 1; k <= n; k++) {
					cin >> X[i][j][l][k];
					Y[i][j][l][k] = X[i][j][l][k];
				}
			}
		}
	}

	for (int i = 1; i <= 4; i++) calc(i);
	//cout << "HERE!"; return ;
	
	for (int i = 1; i <= n-m+1; i++) {
		for (int j = 1; j <= n-m+1; j++) {
			for (int l = 1; l <= n-m+1; l++) {
				for (int k = 1; k <= n-m+1; k++) {
					cout << Y[i][j][l][k] << ' ';
				}
			}
		}
	}
}
int main() {IOS solve(); return 0;}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 4432 KB Output is correct
2 Correct 2 ms 4432 KB Output is correct
3 Correct 2 ms 6492 KB Output is correct
4 Correct 3 ms 6480 KB Output is correct
5 Correct 3 ms 6480 KB Output is correct
6 Correct 8 ms 8680 KB Output is correct
7 Correct 8 ms 8528 KB Output is correct
8 Correct 21 ms 10576 KB Output is correct
9 Correct 27 ms 12264 KB Output is correct
10 Correct 23 ms 10720 KB Output is correct
11 Correct 61 ms 13288 KB Output is correct
12 Correct 128 ms 15944 KB Output is correct
13 Correct 84 ms 14664 KB Output is correct
14 Correct 123 ms 20704 KB Output is correct
15 Correct 200 ms 26184 KB Output is correct
16 Correct 157 ms 14668 KB Output is correct
17 Correct 207 ms 16104 KB Output is correct
18 Correct 230 ms 27976 KB Output is correct
19 Correct 282 ms 32244 KB Output is correct
20 Correct 176 ms 30032 KB Output is correct