# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
152763 | beso123 | Hyper-minimum (IZhO11_hyper) | C++14 | 2017 ms | 1144 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#define int long long
using namespace std;
int n,m;
int a[36][36][36][36];
int calc(int x,int y,int z,int t){
int pas=0;
pas+=t;
pas+=(z-1)*n;
pas+=(y-1)*n*n;
pas+=(x-1)*n*n*n;
return pas;
}
int get(int k,int i,int j,int h,int d1,int d2,int d3,int d4){
if(d1>m-1 || d2>m-1 || d3>m-1 || d4>m-1)
return INT_MAX;
int pas=min(get(k+1,i,j,h,d1+1,d2,d3,d4),min(get(k,i+1,j,h,d1,d2+1,d3,d4),min(get(k,i,j+1,h,d1,d2,d3+1,d4),get(k,i,j,h+1,d1,d2,d3,d4+1))));
return min(pas,a[k][i][j][h]);
}
main(){
cin>>n>>m;
for(int k=1;k<=n;k++){
for(int i=1;i<=n;i++){
for(int j=1;j<=n;j++){
for(int h=1;h<=n;h++){
int u;
cin>>u;
a[k][i][j][h]=u;
}
}
}
}
int N=n*n*n*n;
for(int k=1;k<=n-m+1;k++){
for(int i=1;i<=n-m+1;i++){
for(int j=1;j<=n-m+1;j++){
for(int h=1;h<=n-m+1;h++){
cout<<get(k,i,j,h,0,0,0,0)<<' ';
}
}
}
}
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |