Submission #1065077

# Submission time Handle Problem Language Result Execution time Memory
1065077 2024-08-18T22:24:01 Z aaaaaarroz Rectangles (IOI19_rect) C++17
0 / 100
2 ms 1296 KB
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll count_rectangles(vector<vector<int>> a) {
    int n=a.size(),m=a[0].size();
    map<tuple<int,int,int>,int>maximo_fila;
    for(int k=1;k<m-1;k++){
        for(int i=1;i<n-1;i++){
            for(int j=1;j<n-1;j++){
                maximo_fila[{k,i,j}]=max(a[j][k],maximo_fila[{k,i,j-1}]);
            }
        }
    }
    map<tuple<int,int,int>,int>maximo_columna;
    for(int k=1;k<n-1;k++){
        for(int i=1;i<m-1;i++){
            for(int j=1;j<m-1;j++){
                maximo_columna[{k,i,j}]=max(a[j][k],maximo_columna[{k,i,j-1}]);
            }
        }
    }
    ll rec;
    for(int i=1;i<n-1;i++){
        for(int j=1;j<n-1;j++){
            for(int k=1;k<m-1;k++){
                for(int l=1;l<m-1;l++){
                    bool posible=true;
                    for(int fila=i;fila<=j;fila++){
                        if(maximo_columna[{fila,k,l}]<a[fila][k-1]&&maximo_columna[{fila,k,l}]<a[fila][l+1]){
                            continue;
                        }
                        else{
                            posible=false;
                            break;
                        }
                    }
                    if(!posible){
                        continue;
                    }
                    for(int columna=k;columna<=l;columna++){
                        if(maximo_fila[{columna,k,l}]<a[columna][i-1]&&maximo_fila[{columna,k,l}]<a[columna][j+1]){
                            continue;
                        }
                        else{
                            posible=false;
                            break;
                        }
                    }
                    rec+=(posible);
                }
            }
        }
    }
    return rec;
}

Compilation message

rect.cpp: In function 'll count_rectangles(std::vector<std::vector<int> >)':
rect.cpp:54:12: warning: 'rec' may be used uninitialized in this function [-Wmaybe-uninitialized]
   54 |     return rec;
      |            ^~~
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 1296 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -