Submission #572244

# Submission time Handle Problem Language Result Execution time Memory
572244 2022-06-04T05:41:09 Z SSRS Hyper-minimum (IZhO11_hyper) C++14
100 / 100
752 ms 36680 KB
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N, M;
  cin >> N >> M;
  vector<vector<vector<vector<int>>>> X(N, vector<vector<vector<int>>>(N, vector<vector<int>>(N, vector<int>(N))));
  for (int i = 0; i < N; i++){
    for (int j = 0; j < N; j++){
      for (int k = 0; k < N; k++){
        for (int l = 0; l < N; l++){
          cin >> X[i][j][k][l];
        }
      }
    }
  }
  for (int i = 0; i < N; i++){
    for (int j = 0; j < N; j++){
      for (int k = 0; k < N; k++){
        for (int l = 0; l <= N - M; l++){
          for (int m = 0; m < M; m++){
            X[i][j][k][l] = min(X[i][j][k][l], X[i][j][k][l + m]);
          }
        }
      }
    }
  }
  for (int i = 0; i < N; i++){
    for (int j = 0; j < N; j++){
      for (int k = 0; k <= N - M; k++){
        for (int l = 0; l < M; l++){
          for (int m = 0; m <= N - M; m++){
            X[i][j][k][m] = min(X[i][j][k][m], X[i][j][k + l][m]);
          }
        }
      }
    }
  }
  for (int i = 0; i < N; i++){
    for (int j = 0; j <= N - M; j++){
      for (int k = 0; k < M; k++){
        for (int l = 0; l <= N - M; l++){
          for (int m = 0; m <= N - M; m++){
            X[i][j][l][m] = min(X[i][j][l][m], X[i][j + k][l][m]);
          }
        }
      }
    }
  }
  for (int i = 0; i <= N - M; i++){
    for (int j = 0; j < M; j++){
      for (int k = 0; k <= N - M; k++){
        for (int l = 0; l <= N - M; l++){
          for (int m = 0; m <= N - M; m++){
            X[i][k][l][m] = min(X[i][k][l][m], X[i + j][k][l][m]);
          }
        }
      }
    }
  }
  for (int i = 0; i <= N - M; i++){
    for (int j = 0; j <= N - M; j++){
      for (int k = 0; k <= N - M; k++){
        for (int l = 0; l <= N - M; l++){
          cout << X[i][j][k][l];
          if (i < N - M || j < N - M || k < N - M || l < N - M){
            cout << ' ';
          }
        }
      }
    }
  }
  cout << endl;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 4 ms 468 KB Output is correct
4 Correct 5 ms 488 KB Output is correct
5 Correct 6 ms 468 KB Output is correct
6 Correct 25 ms 1300 KB Output is correct
7 Correct 25 ms 1172 KB Output is correct
8 Correct 63 ms 2812 KB Output is correct
9 Correct 80 ms 4488 KB Output is correct
10 Correct 73 ms 2932 KB Output is correct
11 Correct 175 ms 7096 KB Output is correct
12 Correct 471 ms 13900 KB Output is correct
13 Correct 332 ms 12652 KB Output is correct
14 Correct 376 ms 18616 KB Output is correct
15 Correct 586 ms 29984 KB Output is correct
16 Correct 480 ms 18560 KB Output is correct
17 Correct 520 ms 19860 KB Output is correct
18 Correct 752 ms 36680 KB Output is correct
19 Correct 658 ms 25688 KB Output is correct
20 Correct 596 ms 23836 KB Output is correct