Submission #1065090

# Submission time Handle Problem Language Result Execution time Memory
1065090 2024-08-18T22:31:02 Z aaaaaarroz Rectangles (IOI19_rect) C++17
25 / 100
5000 ms 765432 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=i;j<n-1;j++){
                if(j==i){
                    maximo_fila[{k,i,j}]=a[j][k];
                }
                else{
                    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=i;j<m-1;j++){
                if(j==i){
                    maximo_columna[{k,i,j}]=a[k][j];
                }
                else{
                    maximo_columna[{k,i,j}]=max(a[k][j],maximo_columna[{k,i,j-1}]);
                }
            }
        }
    }
    ll rec=0;
    for(int i=1;i<n-1;i++){
        for(int j=i;j<n-1;j++){
            for(int k=1;k<m-1;k++){
                for(int l=k;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,i,j}]<a[i-1][columna]&&maximo_fila[{columna,i,j}]<a[j+1][columna]){
                            continue;
                        }
                        else{
                            posible=false;
                            break;
                        }
                    }
                    rec+=(posible);
                }
            }
        }
    }
    return rec;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 42 ms 1628 KB Output is correct
3 Correct 44 ms 1628 KB Output is correct
4 Correct 42 ms 1624 KB Output is correct
5 Correct 11 ms 1628 KB Output is correct
6 Correct 13 ms 1876 KB Output is correct
7 Correct 2 ms 604 KB Output is correct
8 Correct 3 ms 604 KB Output is correct
9 Correct 13 ms 1868 KB Output is correct
10 Correct 13 ms 1628 KB Output is correct
11 Correct 13 ms 1628 KB Output is correct
12 Correct 13 ms 1628 KB Output is correct
13 Correct 0 ms 428 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 0 ms 432 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
19 Correct 13 ms 1872 KB Output is correct
20 Correct 3 ms 860 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 42 ms 1628 KB Output is correct
3 Correct 44 ms 1628 KB Output is correct
4 Correct 42 ms 1624 KB Output is correct
5 Correct 11 ms 1628 KB Output is correct
6 Correct 13 ms 1876 KB Output is correct
7 Correct 2 ms 604 KB Output is correct
8 Correct 3 ms 604 KB Output is correct
9 Correct 13 ms 1868 KB Output is correct
10 Correct 13 ms 1628 KB Output is correct
11 Correct 13 ms 1628 KB Output is correct
12 Correct 13 ms 1628 KB Output is correct
13 Correct 0 ms 428 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 0 ms 432 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
19 Correct 13 ms 1872 KB Output is correct
20 Correct 3 ms 860 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 4337 ms 30588 KB Output is correct
23 Correct 4281 ms 30548 KB Output is correct
24 Correct 4233 ms 30544 KB Output is correct
25 Correct 1098 ms 30408 KB Output is correct
26 Correct 1182 ms 29980 KB Output is correct
27 Correct 1139 ms 30036 KB Output is correct
28 Correct 1247 ms 30388 KB Output is correct
29 Correct 246 ms 11344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 42 ms 1628 KB Output is correct
3 Correct 44 ms 1628 KB Output is correct
4 Correct 42 ms 1624 KB Output is correct
5 Correct 11 ms 1628 KB Output is correct
6 Correct 13 ms 1876 KB Output is correct
7 Correct 2 ms 604 KB Output is correct
8 Correct 3 ms 604 KB Output is correct
9 Correct 13 ms 1868 KB Output is correct
10 Correct 13 ms 1628 KB Output is correct
11 Correct 13 ms 1628 KB Output is correct
12 Correct 13 ms 1628 KB Output is correct
13 Correct 0 ms 428 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 4337 ms 30588 KB Output is correct
18 Correct 4281 ms 30548 KB Output is correct
19 Correct 4233 ms 30544 KB Output is correct
20 Correct 1098 ms 30408 KB Output is correct
21 Correct 1182 ms 29980 KB Output is correct
22 Correct 1139 ms 30036 KB Output is correct
23 Correct 1247 ms 30388 KB Output is correct
24 Correct 246 ms 11344 KB Output is correct
25 Correct 0 ms 432 KB Output is correct
26 Correct 1 ms 348 KB Output is correct
27 Correct 13 ms 1872 KB Output is correct
28 Correct 3 ms 860 KB Output is correct
29 Correct 0 ms 348 KB Output is correct
30 Execution timed out 5031 ms 489448 KB Time limit exceeded
31 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 42 ms 1628 KB Output is correct
3 Correct 44 ms 1628 KB Output is correct
4 Correct 42 ms 1624 KB Output is correct
5 Correct 11 ms 1628 KB Output is correct
6 Correct 13 ms 1876 KB Output is correct
7 Correct 2 ms 604 KB Output is correct
8 Correct 3 ms 604 KB Output is correct
9 Correct 13 ms 1868 KB Output is correct
10 Correct 13 ms 1628 KB Output is correct
11 Correct 13 ms 1628 KB Output is correct
12 Correct 13 ms 1628 KB Output is correct
13 Correct 0 ms 428 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 4337 ms 30588 KB Output is correct
18 Correct 4281 ms 30548 KB Output is correct
19 Correct 4233 ms 30544 KB Output is correct
20 Correct 1098 ms 30408 KB Output is correct
21 Correct 1182 ms 29980 KB Output is correct
22 Correct 1139 ms 30036 KB Output is correct
23 Correct 1247 ms 30388 KB Output is correct
24 Correct 246 ms 11344 KB Output is correct
25 Execution timed out 5031 ms 489448 KB Time limit exceeded
26 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2344 ms 195928 KB Output is correct
2 Correct 1553 ms 141396 KB Output is correct
3 Correct 1670 ms 195900 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1722 ms 195916 KB Output is correct
6 Correct 1652 ms 196136 KB Output is correct
7 Correct 1662 ms 195920 KB Output is correct
8 Correct 1672 ms 196112 KB Output is correct
9 Correct 1655 ms 195952 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 432 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 13 ms 1872 KB Output is correct
4 Correct 3 ms 860 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Execution timed out 5076 ms 765432 KB Time limit exceeded
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 42 ms 1628 KB Output is correct
3 Correct 44 ms 1628 KB Output is correct
4 Correct 42 ms 1624 KB Output is correct
5 Correct 11 ms 1628 KB Output is correct
6 Correct 13 ms 1876 KB Output is correct
7 Correct 2 ms 604 KB Output is correct
8 Correct 3 ms 604 KB Output is correct
9 Correct 13 ms 1868 KB Output is correct
10 Correct 13 ms 1628 KB Output is correct
11 Correct 13 ms 1628 KB Output is correct
12 Correct 13 ms 1628 KB Output is correct
13 Correct 0 ms 428 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 4337 ms 30588 KB Output is correct
18 Correct 4281 ms 30548 KB Output is correct
19 Correct 4233 ms 30544 KB Output is correct
20 Correct 1098 ms 30408 KB Output is correct
21 Correct 1182 ms 29980 KB Output is correct
22 Correct 1139 ms 30036 KB Output is correct
23 Correct 1247 ms 30388 KB Output is correct
24 Correct 246 ms 11344 KB Output is correct
25 Execution timed out 5031 ms 489448 KB Time limit exceeded
26 Halted 0 ms 0 KB -