Submission #17723

# Submission time Handle Problem Language Result Execution time Memory
17723 2016-01-12T09:16:38 Z Erzhann Hyper-minimum (IZhO11_hyper) C++
100 / 100
768 ms 41088 KB
/*
  /\     /\
  | ).|.( |
  |  >-<  |
  =========
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
1 Correct 0 ms 41088 KB Output is correct
2 Correct 0 ms 41088 KB Output is correct
3 Correct 0 ms 41088 KB Output is correct
4 Correct 5 ms 41088 KB Output is correct
5 Correct 0 ms 41088 KB Output is correct
6 Correct 18 ms 41088 KB Output is correct
7 Correct 7 ms 41088 KB Output is correct
8 Correct 52 ms 41088 KB Output is correct
9 Correct 52 ms 41088 KB Output is correct
10 Correct 52 ms 41088 KB Output is correct
11 Correct 123 ms 41088 KB Output is correct
12 Correct 288 ms 41088 KB Output is correct
13 Correct 402 ms 41088 KB Output is correct
14 Correct 233 ms 41088 KB Output is correct
15 Correct 269 ms 41088 KB Output is correct
16 Correct 575 ms 41088 KB Output is correct
17 Correct 422 ms 41088 KB Output is correct
18 Correct 470 ms 41088 KB Output is correct
19 Correct 532 ms 41088 KB Output is correct
20 Correct 768 ms 41088 KB Output is correct