# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
338086 | juggernaut | Hyper-minimum (IZhO11_hyper) | C++14 | 898 ms | 58348 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>
using namespace std;
int n,m,i,j,k,l,g;
int main(){
cin>>n>>m;
int dp[5][n][n][n][n];
for(i=0;i<n;i++)
for(j=0;j<n;j++)
for(k=0;k<n;k++)
for(l=0;l<n;l++)cin>>dp[4][i][j][k][l];
for(i=0;i<n;i++)
for(j=0;j<n;j++)
for(k=0;k<n;k++)
for(l=0;l<n;l++){
dp[3][i][j][k][l]=2e9;
for(g=l;g<min(n,l+m);g++)
dp[3][i][j][k][l]=min(dp[3][i][j][k][l],dp[4][i][j][k][g]);
}
for(i=0;i<n;i++)
for(j=0;j<n;j++)
for(k=0;k<n;k++)
for(l=0;l<n;l++){
dp[2][i][j][k][l]=2e9;
for(g=k;g<min(n,k+m);g++)
dp[2][i][j][k][l]=min(dp[2][i][j][k][l],dp[3][i][j][g][l]);
}
for(i=0;i<n;i++)
for(j=0;j<n;j++)
for(k=0;k<n;k++)
for(l=0;l<n;l++){
dp[1][i][j][k][l]=2e9;
for(g=j;g<min(n,j+m);g++)
dp[1][i][j][k][l]=min(dp[1][i][j][k][l],dp[2][i][g][k][l]);
}
for(i=0;i<n;i++)
for(j=0;j<n;j++)
for(k=0;k<n;k++)
for(l=0;l<n;l++){
dp[0][i][j][k][l]=2e9;
for(g=i;g<min(n,i+m);g++)
dp[0][i][j][k][l]=min(dp[0][i][j][k][l],dp[1][g][j][k][l]);
}
for(i=0;i<n+1-m;i++)
for(j=0;j<n+1-m;j++)
for(k=0;k<n+1-m;k++)
for(l=0;l<n+1-m;l++)
cout<<dp[0][i][j][k][l]<<' ';
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |