# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
152921 | 2019-09-10T13:18:02 Z | beso123 | Hyper-minimum (IZhO11_hyper) | C++14 | 822 ms | 41512 KB |
#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
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 380 KB | Output is correct |
2 | Correct | 3 ms | 476 KB | Output is correct |
3 | Correct | 7 ms | 1400 KB | Output is correct |
4 | Correct | 7 ms | 1400 KB | Output is correct |
5 | Correct | 8 ms | 1528 KB | Output is correct |
6 | Correct | 25 ms | 3320 KB | Output is correct |
7 | Correct | 21 ms | 3192 KB | Output is correct |
8 | Correct | 59 ms | 6136 KB | Output is correct |
9 | Correct | 91 ms | 7776 KB | Output is correct |
10 | Correct | 60 ms | 6136 KB | Output is correct |
11 | Correct | 152 ms | 11512 KB | Output is correct |
12 | Correct | 291 ms | 19064 KB | Output is correct |
13 | Correct | 260 ms | 17948 KB | Output is correct |
14 | Correct | 422 ms | 23800 KB | Output is correct |
15 | Correct | 651 ms | 35208 KB | Output is correct |
16 | Correct | 392 ms | 23752 KB | Output is correct |
17 | Correct | 425 ms | 25044 KB | Output is correct |
18 | Correct | 822 ms | 41512 KB | Output is correct |
19 | Correct | 534 ms | 30456 KB | Output is correct |
20 | Correct | 513 ms | 28360 KB | Output is correct |