# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
764528 | Trunkty | Hyper-minimum (IZhO11_hyper) | C++14 | 497 ms | 123212 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;
typedef long long ll;
#define int ll
int n,m;
int arr[45][45][45][45],mini1[45][45][45][45],mini2[45][45][45][45],mini3[45][45][45][45],mini4[45][45][45][45];
signed main(){
ios::sync_with_stdio(false);
cin.tie(NULL);
cin >> n >> m;
for(int i=1;i<=n;i++){
for(int j=1;j<=n;j++){
for(int k=1;k<=n;k++){
for(int l=1;l<=n;l++){
cin >> arr[i][j][k][l];
}
}
}
}
for(int i=1;i<=n;i++){
for(int j=1;j<=n;j++){
for(int k=1;k<=n;k++){
multiset<int> s;
for(int l=n;l>=1;l--){
if(l<=n-m){
s.erase(s.find(arr[i][j][k][l+m]));
}
s.insert(arr[i][j][k][l]);
if(l<=n-m+1LL){
mini1[i][j][k][l] = *s.begin();
}
}
}
}
}
for(int i=1;i<=n;i++){
for(int j=1;j<=n;j++){
for(int k=1;k<=n;k++){
multiset<int> s;
for(int l=n;l>=1;l--){
if(l<=n-m){
s.erase(s.find(mini1[i][j][l+m][k]));
}
s.insert(mini1[i][j][l][k]);
if(l<=n-m+1LL){
mini2[i][j][l][k] = *s.begin();
}
}
}
}
}
for(int i=1;i<=n;i++){
for(int j=1;j<=n;j++){
for(int k=1;k<=n;k++){
multiset<int> s;
for(int l=n;l>=1;l--){
if(l<=n-m){
s.erase(s.find(mini2[i][l+m][j][k]));
}
s.insert(mini2[i][l][j][k]);
if(l<=n-m+1LL){
mini3[i][l][j][k] = *s.begin();
}
}
}
}
}
for(int i=1;i<=n;i++){
for(int j=1;j<=n;j++){
for(int k=1;k<=n;k++){
multiset<int> s;
for(int l=n;l>=1;l--){
if(l<=n-m){
s.erase(s.find(mini3[l+m][i][j][k]));
}
s.insert(mini3[l][i][j][k]);
if(l<=n-m+1LL){
mini4[l][i][j][k] = *s.begin();
}
}
}
}
}
for(int i=1;i<=n-m+1LL;i++){
for(int j=1;j<=n-m+1LL;j++){
for(int k=1;k<=n-m+1LL;k++){
for(int l=1;l<=n-m+1LL;l++){
cout << mini4[i][j][k][l] << " ";
}
}
}
}
cout << "\n";
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |