#include <bits/stdc++.h>
using namespace std;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n,m;
cin >> n >> m;
vector<vector<vector<vector<int>>>> v(n,vector<vector<vector<int>>>(n,vector<vector<int>>(n,vector<int>(n))));
for(int i=0;i<n;i++){
for(int j=0;j<n;j++){
for(int k = 0;k<n;k++){
for(int c = 0;c<n;c++){
cin >> v[i][j][k][c];
}
}
}
}
for(int x=1;x<=4;x++){
vector<vector<vector<vector<int>>>> v2(n,vector<vector<vector<int>>>(n,vector<vector<int>>(n,vector<int>(n,1e9))));
for(int i=0;i<n;i++){
for(int j=0;j<n;j++){
for(int k = 0;k<n;k++){
for(int c = 0;c<n;c++){
for(int d = 0;d<m;d++){
if(x == 1 && c + d < n){
v2[i][j][k][c] = min(v2[i][j][k][c],v[i][j][k][c+d]);
}
if(x == 2 && k + d < n){
v2[i][j][k][c] = min(v2[i][j][k][c],v[i][j][k+d][c]);
}
if(x == 3 && j + d < n){
v2[i][j][k][c] = min(v2[i][j][k][c],v[i][j+d][k][c]);
}
if(x == 4 && i + d < n){
v2[i][j][k][c] = min(v2[i][j][k][c],v[i+d][j][k][c]);
}
}
}
}
}
}
v = v2;
}
for(int i=0;i<n;i++){
for(int j=0;j<n;j++){
for(int k = 0;k<n;k++){
for(int c = 0;c<n;c++){
cout << v[i][j][k][c] << " ";
}
}
}
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Incorrect |
5 ms |
332 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |