# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
88677 | khohko | Hyper-minimum (IZhO11_hyper) | C++17 | 2043 ms | 220580 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;
#define ll int
#define pb push_back
#define fr first
#define sc second
#define ARRS int(1e5+11)
#define MAX ((int)(1e9+1))
#define HS1 ((long long)(1000001329))
#define HS2 ((long long)(1000001531))
#define MOD ((long long)1000000007)
#define MD ((long long)1000000007)
ll i,j,l,k,n,m,p,d,mx,x,o,y,ans,res,sum;
ll a[35][35][35][35];
ll mn[36][35][35][35][35];
ll N,pp;
ll go(ll n,ll i,ll j,ll k,ll p){
if(n==1)
return mn[n][i][j][k][p]=a[i][j][k][p];
if(i+n>N)return MAX;
if(j+n>N)return MAX;
if(k+n>N)return MAX;
if(p+n>N)return MAX;
if(mn[n][i][j][k][p]!=MAX)return mn[n][i][j][k][p];
mn[n][i][j][k][p]=min({a[i][j][k][p],
go(n-1,i,j,k,p+1),
go(n-1,i,j,k+1,p),
go(n-1,i,j,k+1,p+1),
go(n-1,i,j+1,k,p),
go(n-1,i,j+1,k,p+1),
go(n-1,i,j+1,k+1,p),
go(n-1,i,j+1,k+1,p+1),
go(n-1,i+1,j,k,p),
go(n-1,i+1,j,k,p+1),
go(n-1,i+1,j,k+1,p),
go(n-1,i+1,j,k+1,p+1),
go(n-1,i+1,j+1,k,p),
go(n-1,i+1,j+1,k,p+1),
go(n-1,i+1,j+1,k+1,p),
go(n-1,i+1,j+1,k+1,p+1),
});
// cout<<i<<" "<<j<<" "<<k<<" "<<p<<" "<<n<<" "<<mn[n][i][j][k][p]<<endl;
return mn[n][i][j][k][p];
}
int main(){
#ifdef KHOKHO
freopen("in.in","r",stdin);
freopen("out.out","w+",stdout);
#endif //KHOKHO
cin>>n>>m;
N=n;
for(i=0; i<n; i++){
for(j=0; j<n; j++){
for(k=0; k<n; k++){
for(p=0; p<n; p++){
//cin>>a[i][j][k][p];
scanf("%d",&a[i][j][k][p]);
// cout<<a[i][j][k][p]<<" ";
}}}}//cout<<endl;}cout<<endl;}cout<<endl;}
for(i=0; i<n; i++)
for(j=0; j<n; j++)
for(k=0; k<n; k++)
for(p=0; p<n; p++)
for(pp=0; pp<=m; pp++)
mn[pp][i][j][k][p]=MAX;
for(i=0; i<n; i++)
for(j=0; j<n; j++)
for(k=0; k<n; k++)
for(p=0; p<n; p++)
go(m,i,j,k,p);
// go(m,0,0,1,0);
for(i=0; i<n-m+1; i++){
for(j=0; j<n-m+1; j++){
for(k=0; k<n-m+1; k++){
for(p=0; p<n-m+1; p++){
// cin>>a[i][j][k][p];
printf("%d ",mn[m][i][j][k][p]);
}}}}
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |