#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[35][35][35][35];
int Y[35][35][35][35];
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;}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
2384 KB |
Output is correct |
2 |
Correct |
2 ms |
6480 KB |
Output is correct |
3 |
Correct |
2 ms |
6736 KB |
Output is correct |
4 |
Correct |
3 ms |
6736 KB |
Output is correct |
5 |
Correct |
3 ms |
6736 KB |
Output is correct |
6 |
Correct |
9 ms |
11348 KB |
Output is correct |
7 |
Correct |
9 ms |
11088 KB |
Output is correct |
8 |
Correct |
22 ms |
12368 KB |
Output is correct |
9 |
Correct |
27 ms |
14080 KB |
Output is correct |
10 |
Correct |
26 ms |
12368 KB |
Output is correct |
11 |
Correct |
62 ms |
15448 KB |
Output is correct |
12 |
Correct |
142 ms |
20576 KB |
Output is correct |
13 |
Correct |
93 ms |
19428 KB |
Output is correct |
14 |
Correct |
136 ms |
25436 KB |
Output is correct |
15 |
Correct |
194 ms |
35400 KB |
Output is correct |
16 |
Correct |
176 ms |
23880 KB |
Output is correct |
17 |
Correct |
209 ms |
25160 KB |
Output is correct |
18 |
Runtime error |
169 ms |
39168 KB |
Execution killed with signal 11 |
19 |
Halted |
0 ms |
0 KB |
- |