답안 #412297

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
412297 2021-05-26T16:52:10 Z ritul_kr_singh 최솟값 배열 (IZhO11_hyper) C++17
0 / 100
3 ms 588 KB
#pragma GCC optimize("Ofast,unroll-loops")

#include <bits/stdc++.h>
using namespace std;
#define int long long
#define sp << ' ' <<
#define nl << '\n'

signed main(){
	cin.tie(0)->sync_with_stdio(0);
	int n, m; cin >> n >> m; --m;
	int a[n][n][n][n];

	for(int i=0; i<n; ++i)
		for(int j=0; j<n; ++j)
			for(int k=0; k<n; ++k)
				for(int l=0; l<n; ++l)
					cin >> a[i][j][k][l];

	for(int i=0; i<n; ++i)
		for(int j=0; j<n; ++j)
			for(int k=0; k<n; ++k)
				for(int l=0; l<n; ++l)
					for(int x=i; x<=i+m; ++x)
						a[i][j][k][l] = min(a[i][j][k][l], a[x][j][k][l]);
	for(int i=0; i<n; ++i)
		for(int j=0; j<n; ++j)
			for(int k=0; k<n; ++k)
				for(int l=0; l<n; ++l)
					for(int x=j; x<=j+m; ++x)
						a[i][j][k][l] = min(a[i][j][k][l], a[i][x][k][l]);

	for(int i=0; i<n; ++i)
		for(int j=0; j<n; ++j)
			for(int k=0; k<n; ++k)
				for(int l=0; l<n; ++l)
					for(int x=k; x<=k+m; ++x)
						a[i][j][k][l] = min(a[i][j][k][l], a[i][j][x][l]);
	for(int i=0; i<n; ++i)
		for(int j=0; j<n; ++j)
			for(int k=0; k<n; ++k)
				for(int l=0; l<n; ++l)
					for(int x=l; x<=l+m; ++x)
						a[i][j][k][l] = min(a[i][j][k][l], a[i][j][k][x]);

	for(int i=0; i<n-m; ++i)
		for(int j=0; j<n-m; ++j)
			for(int k=0; k<n-m; ++k)
				for(int l=0; l<n-m; ++l)
					cout << a[i][j][k][l] << ' ';
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Runtime error 3 ms 588 KB Execution killed with signal 11
4 Halted 0 ms 0 KB -