답안 #521682

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
521682 2022-02-02T17:57:33 Z Kalashnikov 최솟값 배열 (IZhO11_hyper) C++17
100 / 100
384 ms 25092 KB
#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 = 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 ++) {
					scanf("%d" , &a[i][j][k][l][1]);
				}
			}
		}
	}
	for(int h = 2; h <= m; h ++) {
		for(int i = 0; i < n-h+1; i ++) {
			for(int j = 0; j < n-h+1; j ++) {
				for(int k = 0; k < n-h+1; k ++) {
					for(int l = 0; 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 = 0; i < n-m+1; i ++) {
		for(int j = 0; j < n-m+1; j ++) {
			for(int k = 0; k < n-m+1; k ++) {
				for(int l = 0; l < n-m+1; l ++) {
					printf("%d ", a[i][j][k][l][m%2]);
				}
			}
		}
	}
}
/*
*/
main() {
    // ios;
    int tt = 1 , tc = 0;
    // cin >> tt;
    while(tt --) {
        solve(++tc);
    }
    return 0;
}

Compilation message

hyper.cpp:61:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   61 | main() {
      | ^~~~
hyper.cpp: In function 'void solve(int)':
hyper.cpp:24:11: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   24 |      scanf("%d" , &a[i][j][k][l][1]);
      |      ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 332 KB Output is correct
3 Correct 2 ms 844 KB Output is correct
4 Correct 2 ms 972 KB Output is correct
5 Correct 3 ms 972 KB Output is correct
6 Correct 11 ms 2224 KB Output is correct
7 Correct 10 ms 2096 KB Output is correct
8 Correct 31 ms 4020 KB Output is correct
9 Correct 34 ms 5696 KB Output is correct
10 Correct 32 ms 4036 KB Output is correct
11 Correct 86 ms 7020 KB Output is correct
12 Correct 194 ms 10136 KB Output is correct
13 Correct 191 ms 8948 KB Output is correct
14 Correct 177 ms 14840 KB Output is correct
15 Correct 239 ms 22312 KB Output is correct
16 Correct 291 ms 10820 KB Output is correct
17 Correct 296 ms 12212 KB Output is correct
18 Correct 318 ms 25092 KB Output is correct
19 Correct 384 ms 14260 KB Output is correct
20 Correct 378 ms 11940 KB Output is correct