Submission #1065104

# Submission time Handle Problem Language Result Execution time Memory
1065104 2024-08-18T22:43:33 Z aaaaaarroz Rectangles (IOI19_rect) C++17
37 / 100
1999 ms 1048576 KB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll count_rectangles(const vector<vector<int>>a) {
    int n = a.size();
    int m = a[0].size();
    vector<vector<vector<int>>> maximo_fila(m, vector<vector<int>>(n, vector<int>(n, 0)));
    vector<vector<vector<int>>> maximo_columna(n, vector<vector<int>>(m, vector<int>(m, 0)));
    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]);
                }
            }
        }
    }
    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]) {
                            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]) {
                            posible = false;
                            break;
                        }
                    }
                    if (posible) {
                        ++rec;
                    }
                }
            }
        }
    }
    return rec;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 604 KB Output is correct
3 Correct 1 ms 604 KB Output is correct
4 Correct 1 ms 692 KB Output is correct
5 Correct 1 ms 604 KB Output is correct
6 Correct 1 ms 604 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 604 KB Output is correct
10 Correct 1 ms 604 KB Output is correct
11 Correct 1 ms 604 KB Output is correct
12 Correct 1 ms 604 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 360 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 1 ms 604 KB Output is correct
20 Correct 1 ms 348 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 604 KB Output is correct
3 Correct 1 ms 604 KB Output is correct
4 Correct 1 ms 692 KB Output is correct
5 Correct 1 ms 604 KB Output is correct
6 Correct 1 ms 604 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 604 KB Output is correct
10 Correct 1 ms 604 KB Output is correct
11 Correct 1 ms 604 KB Output is correct
12 Correct 1 ms 604 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 360 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 1 ms 604 KB Output is correct
20 Correct 1 ms 348 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 41 ms 4956 KB Output is correct
23 Correct 38 ms 4956 KB Output is correct
24 Correct 40 ms 4952 KB Output is correct
25 Correct 19 ms 4956 KB Output is correct
26 Correct 19 ms 4996 KB Output is correct
27 Correct 20 ms 4956 KB Output is correct
28 Correct 21 ms 5052 KB Output is correct
29 Correct 6 ms 2140 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 604 KB Output is correct
3 Correct 1 ms 604 KB Output is correct
4 Correct 1 ms 692 KB Output is correct
5 Correct 1 ms 604 KB Output is correct
6 Correct 1 ms 604 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 604 KB Output is correct
10 Correct 1 ms 604 KB Output is correct
11 Correct 1 ms 604 KB Output is correct
12 Correct 1 ms 604 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 360 KB Output is correct
17 Correct 41 ms 4956 KB Output is correct
18 Correct 38 ms 4956 KB Output is correct
19 Correct 40 ms 4952 KB Output is correct
20 Correct 19 ms 4956 KB Output is correct
21 Correct 19 ms 4996 KB Output is correct
22 Correct 20 ms 4956 KB Output is correct
23 Correct 21 ms 5052 KB Output is correct
24 Correct 6 ms 2140 KB Output is correct
25 Correct 0 ms 348 KB Output is correct
26 Correct 0 ms 348 KB Output is correct
27 Correct 1 ms 604 KB Output is correct
28 Correct 1 ms 348 KB Output is correct
29 Correct 0 ms 348 KB Output is correct
30 Correct 1922 ms 66640 KB Output is correct
31 Correct 1953 ms 66908 KB Output is correct
32 Correct 1999 ms 66896 KB Output is correct
33 Correct 765 ms 66548 KB Output is correct
34 Correct 754 ms 66816 KB Output is correct
35 Correct 765 ms 66968 KB Output is correct
36 Correct 762 ms 66756 KB Output is correct
37 Correct 778 ms 65176 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 604 KB Output is correct
3 Correct 1 ms 604 KB Output is correct
4 Correct 1 ms 692 KB Output is correct
5 Correct 1 ms 604 KB Output is correct
6 Correct 1 ms 604 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 604 KB Output is correct
10 Correct 1 ms 604 KB Output is correct
11 Correct 1 ms 604 KB Output is correct
12 Correct 1 ms 604 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 360 KB Output is correct
17 Correct 41 ms 4956 KB Output is correct
18 Correct 38 ms 4956 KB Output is correct
19 Correct 40 ms 4952 KB Output is correct
20 Correct 19 ms 4956 KB Output is correct
21 Correct 19 ms 4996 KB Output is correct
22 Correct 20 ms 4956 KB Output is correct
23 Correct 21 ms 5052 KB Output is correct
24 Correct 6 ms 2140 KB Output is correct
25 Correct 1922 ms 66640 KB Output is correct
26 Correct 1953 ms 66908 KB Output is correct
27 Correct 1999 ms 66896 KB Output is correct
28 Correct 765 ms 66548 KB Output is correct
29 Correct 754 ms 66816 KB Output is correct
30 Correct 765 ms 66968 KB Output is correct
31 Correct 762 ms 66756 KB Output is correct
32 Correct 778 ms 65176 KB Output is correct
33 Correct 0 ms 348 KB Output is correct
34 Correct 0 ms 348 KB Output is correct
35 Correct 1 ms 604 KB Output is correct
36 Correct 1 ms 348 KB Output is correct
37 Correct 0 ms 348 KB Output is correct
38 Runtime error 354 ms 1048576 KB Execution killed with signal 9
39 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 59 ms 99024 KB Output is correct
2 Correct 43 ms 71764 KB Output is correct
3 Correct 47 ms 99168 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 68 ms 99156 KB Output is correct
6 Correct 53 ms 99152 KB Output is correct
7 Correct 51 ms 99052 KB Output is correct
8 Correct 71 ms 99152 KB Output is correct
9 Correct 50 ms 99152 KB Output is correct
10 Correct 28 ms 49736 KB Output is correct
11 Correct 33 ms 74344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 604 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 600 KB Output is correct
7 Runtime error 378 ms 1048576 KB Execution killed with signal 9
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 604 KB Output is correct
3 Correct 1 ms 604 KB Output is correct
4 Correct 1 ms 692 KB Output is correct
5 Correct 1 ms 604 KB Output is correct
6 Correct 1 ms 604 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 604 KB Output is correct
10 Correct 1 ms 604 KB Output is correct
11 Correct 1 ms 604 KB Output is correct
12 Correct 1 ms 604 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 360 KB Output is correct
17 Correct 41 ms 4956 KB Output is correct
18 Correct 38 ms 4956 KB Output is correct
19 Correct 40 ms 4952 KB Output is correct
20 Correct 19 ms 4956 KB Output is correct
21 Correct 19 ms 4996 KB Output is correct
22 Correct 20 ms 4956 KB Output is correct
23 Correct 21 ms 5052 KB Output is correct
24 Correct 6 ms 2140 KB Output is correct
25 Correct 1922 ms 66640 KB Output is correct
26 Correct 1953 ms 66908 KB Output is correct
27 Correct 1999 ms 66896 KB Output is correct
28 Correct 765 ms 66548 KB Output is correct
29 Correct 754 ms 66816 KB Output is correct
30 Correct 765 ms 66968 KB Output is correct
31 Correct 762 ms 66756 KB Output is correct
32 Correct 778 ms 65176 KB Output is correct
33 Runtime error 354 ms 1048576 KB Execution killed with signal 9
34 Halted 0 ms 0 KB -