# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
17723 | Erzhann | Hyper-minimum (IZhO11_hyper) | C++98 | 768 ms | 41088 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.
/*
/\ /\
| ).|.( |
| >-< |
=========
It's Adilkhan99 miaaaaaau
*/
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define endl "\n"
#define foreach(it, S) for(__typeof (S.begin()) it = S.begin(); it != S.end(); it++)
#define mp make_pair
#define f first
#define s second
#define name ""
#define _ ios_base::sync_with_stdio(false);cin.tie(0);
using namespace std;
const int MaxN = int (2e5) + 256;
const int INF = int(1e9);
const int mod = (int)(1e9) + 7;
int x[36][36][36][36], Q, n , m;
int y[36][36][36][36];
int mn1[36][36][36][36];
int mn2[36][36][36][36];
int mn3[36][36][36][36];
int mn4[36][36][36][36];
int main () {
scanf("%d%d", &n, &m);
for(int i = 1; i <= n; i++)
for(int i1 = 1; i1 <= n; i1++)
for(int i2 = 1; i2 <= n; i2++)
for(int i3 = 1; i3 <= n; i3++)
scanf("%d", &x[i][i1][i2][i3]);
int N = m;
for(int i = 1; i <= n; i++)
for(int i1 = 1; i1 <= n; i1++)
for(int i2 = 1; i2 <= n; i2++)
for(int i3 = 1; i3 <= n; i3++)
mn1[i][i1][i2][i3] = INT_MAX,
mn2[i][i1][i2][i3] = INT_MAX,
mn3[i][i1][i2][i3] = INT_MAX,
mn4[i][i1][i2][i3] = INT_MAX;
for(int i = 1; i <= n; i++)
for(int i1 = 1; i1 <= n; i1++)
for(int i2 = 1; i2 <= n; i2++)
for(int i3 = 1; i3 <= n; i3++)
for(int j = 0; j < N; j++)
if(i3 + j <= n)mn1[i][i1][i2][i3] = min(x[i][i1][i2][i3 + j], mn1[i][i1][i2][i3]);
for(int i = 1; i <= n; i++)
for(int i1 = 1; i1 <= n; i1++)
for(int i2 = 1; i2 <= n; i2++)
for(int i3 = 1; i3 <= n; i3++)
for(int j = 0; j < N; j++)
if(i2 + j <= n)mn2[i][i1][i2][i3] = min(mn1[i][i1][i2 + j][i3], mn2[i][i1][i2][i3]);
for(int i = 1; i <= n; i++)
for(int i1 = 1; i1 <= n; i1++)
for(int i2 = 1; i2 <= n; i2++)
for(int i3 = 1; i3 <= n; i3++)
for(int j = 0; j < N; j++)
if(i1 + j <= n)mn3[i][i1][i2][i3] = min(mn2[i][i1 + j][i2][i3], mn3[i][i1][i2][i3]);
for(int i = 1; i <= n; i++)
for(int i1 = 1; i1 <= n; i1++)
for(int i2 = 1; i2 <= n; i2++)
for(int i3 = 1; i3 <= n; i3++)
for(int j = 0; j < N; j++)
if(i + j <= n)mn4[i][i1][i2][i3] = min(mn3[i + j][i1][i2][i3], mn4[i][i1][i2][i3]);
for(int i = 1; i <= n; i++)
for(int i1 = 1; i1 <= n; i1++)
for(int i2 = 1; i2 <= n; i2++)
for(int i3 = 1; i3 <= n; i3++)
if(i + N - 1 <= n && i1 + N - 1<= n && i2 + N - 1 <= n && i3 + N - 1 <= n)
cout << mn4[i][i1][i2][i3] << " ";
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |