답안 #412300

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
412300 2021-05-26T16:54:31 Z ritul_kr_singh 최솟값 배열 (IZhO11_hyper) C++17
100 / 100
445 ms 27824 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;
	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<min(n, 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<min(n, 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<min(n, 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<min(n, 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 Correct 3 ms 332 KB Output is correct
4 Correct 4 ms 452 KB Output is correct
5 Correct 3 ms 460 KB Output is correct
6 Correct 12 ms 1296 KB Output is correct
7 Correct 10 ms 1200 KB Output is correct
8 Correct 31 ms 3072 KB Output is correct
9 Correct 55 ms 4736 KB Output is correct
10 Correct 34 ms 3188 KB Output is correct
11 Correct 78 ms 7484 KB Output is correct
12 Correct 181 ms 10836 KB Output is correct
13 Correct 181 ms 9644 KB Output is correct
14 Correct 225 ms 15504 KB Output is correct
15 Correct 380 ms 23796 KB Output is correct
16 Correct 267 ms 12224 KB Output is correct
17 Correct 311 ms 13636 KB Output is correct
18 Correct 445 ms 27824 KB Output is correct
19 Correct 313 ms 16940 KB Output is correct
20 Correct 351 ms 14788 KB Output is correct