# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
152921 | beso123 | Hyper-minimum (IZhO11_hyper) | C++14 | 822 ms | 41512 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.
#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)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |