Submission #152921

#TimeUsernameProblemLanguageResultExecution timeMemory
152921beso123Hyper-minimum (IZhO11_hyper)C++14
100 / 100
822 ms41512 KiB
#include <bits/stdc++.h>
using namespace std;
int x[36][36][36][36];
int y[36][36][36][36];
 
int main(){
	int N,M;
	scanf("%d %d", &N, &M);
	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++){
					scanf("%d", &x[i][j][k][l]);
				}
				priority_queue<pair<int, int> > mn;
				for(int l=N-1; l>=0; l--){
					mn.push({-x[i][j][k][l], l});
					while(mn.top().second>=l+M){
						mn.pop();
					}
					y[i][j][k][l] = -mn.top().first;
				}
			}
			for(int l=0; l<N; l++){
				priority_queue<pair<int, int> > mn;
				for(int k=N-1; k>=0; k--){
						mn.push({-y[i][j][k][l], k});
						while(mn.top().second>=k+M){
							mn.pop();
						}
						y[i][j][k][l] = -mn.top().first;
				}
			}
		}
		for(int l=0; l<N; l++){
			for(int k=0; k<N; k++){
				priority_queue<pair<int, int> > mn;
				for(int j=N-1; j>=0; j--){
					mn.push({-y[i][j][k][l], j});
					while(mn.top().second>=j+M){
						mn.pop();
					}
					y[i][j][k][l] = -mn.top().first;
				}
			}
		}
	}
	for(int k=0; k<N; k++){
		for(int l=0; l<N; l++){
			for(int j=0; j<N; j++){
				priority_queue<pair<int, int>> mn;
				for(int i=N-1; i>=0; i--){
					mn.push({-y[i][j][k][l], i});
					while(mn.top().second>=i+M){
						mn.pop();
					}
					y[i][j][k][l] = -mn.top().first;
				}
			}
		}
	}
	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++){
					if(i||j||k||l)
						printf(" ");
					printf("%d", y[i][j][k][l]);
				}
			}
		}
	}
	printf("\n");
	return 0;
}

Compilation message (stderr)

hyper.cpp: In function 'int main()':
hyper.cpp:8:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d %d", &N, &M);
  ~~~~~^~~~~~~~~~~~~~~~~
hyper.cpp:13:11: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
      scanf("%d", &x[i][j][k][l]);
      ~~~~~^~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...