Submission #842359

#TimeUsernameProblemLanguageResultExecution timeMemory
842359AndriaBeridzeHyper-minimum (IZhO11_hyper)C++14
100 / 100
580 ms54992 KiB
#include<bits/stdc++.h> using namespace std; int TC = 0; void dbg_out() {cout << endl;} template<typename Head, typename... Tail> void dbg_out(Head H, Tail... T) {cout << " " << H; dbg_out(T...);} #define debug(...) {cout << "(" << #__VA_ARGS__ << "):"; dbg_out(__VA_ARGS__);} #define IOS ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0); #define int long long #define all(x) x.begin(), x.end() #define rall(x) x.rbegin(), x.rend() #define add push_back #define size(v) (int) v.size() #define left node * 2, l, (l + r) / 2 #define right node * 2 + 1, (l + r) / 2 + 1, r #define check() cout << "Why doesn't this stupid a** code work?" << endl; #define inf (int) 1e18 void solve(){ int n, m; cin >> n >> m; vector<vector<vector<vector<int>>>> v(n, vector<vector<vector<int>>>(n, vector<vector<int>>(n, vector<int>(n, 0)))); 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 >> v[i][j][k][l]; } } } } auto x = v; 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 + 1; l++){ for(int p = l; p <= l + m - 1; p++){ x[i][j][k][l] = min(x[i][j][k][l], v[i][j][k][p]); } } } } } v = x; 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 + 1; l++){ for(int p = l; p <= l + m - 1; p++){ x[i][j][l][k] = min(x[i][j][l][k], v[i][j][p][k]); } } } } } v = x; 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 + 1; l++){ for(int p = l; p <= l + m - 1; p++){ x[i][l][j][k] = min(x[i][l][j][k], v[i][p][j][k]); } } } } } v = x; 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 + 1; l++){ for(int p = l; p <= l + m - 1; p++){ x[l][i][j][k] = min(x[l][i][j][k], v[p][i][j][k]); } } } } } v = x; for(int i = 0; i < n - m + 1; i++){ for(int j = 0; j < n - m + 1; j++){ for(int k = 0; k < n - m + 1; k++){ for(int l = 0; l < n - m + 1; l++){ cout << v[i][j][k][l] << ' '; } } } } cout << endl; } signed main(){ int q = 1; //cin >> q; while(++TC <= q){ solve(); } }
#Verdict Execution timeMemoryGrader output
Fetching results...