# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
523598 | TheKingAleks | Hyper-minimum (IZhO11_hyper) | C++14 | 332 ms | 58020 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;
const int MAX_D = 45;
const int INF = 1e9+7;
const int MAX_N = 1500002;
int x[MAX_D][MAX_D][MAX_D][MAX_D];
int y[MAX_D][MAX_D][MAX_D][MAX_D];
int z[MAX_D][MAX_D][MAX_D][MAX_D];
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int n,m;
cin>>n>>m;
for(int i=1; i<=n; i++)
{
for(int j=1; j<=n; j++)
{
for(int k=1; k<=n; k++)
{
for(int l=1; l<=n; l++)
{
y[i][j][k][l] = z[i][j][k][l] = INF;
}
}
}
}
for(int i=1; i<=n; i++)
{
for(int j=1; j<=n; j++)
{
for(int k=1; k<=n; k++)
{
for(int l=1; l<=n; l++)
{
cin>>x[i][j][k][l];
for(int idx = max(l-m+1,1); idx <= l; idx++)
{
y[i][j][k][idx] = min(y[i][j][k][idx], x[i][j][k][l]);
}
}
}
}
}
for(int i=1; i<=n; i++)
{
for(int j=1; j<=n; j++)
{
for(int k=1; k<=n; k++)
{
for(int l=1; l<=n; l++)
{
for(int idx = max(k-m+1,1); idx <= k; idx++)
{
z[i][j][idx][l] = min(z[i][j][idx][l], y[i][j][k][l]);
}
}
}
}
}
for(int i=1; i<=n-m+1; i++)
{
for(int j=1; j<=n-m+1; j++)
{
for(int k=1; k<=n-m+1; k++)
{
for(int l=1; l<=n-m+1; l++)
{
for(int i2=i; i2<=i+m-1; i2++)
{
for(int j2=j; j2<=j+m-1; j2++)
{
z[i][j][k][l] = min(z[i][j][k][l], z[i2][j2][k][l]);
}
}
cout<<z[i][j][k][l]<<" ";
}
}
}
}
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |