Submission #1065083

#TimeUsernameProblemLanguageResultExecution timeMemory
1065083aaaaaarrozRectangles (IOI19_rect)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; ll count_rectangles(vector<vector<int>>& a) { int n = a.size(); int m = a[0].size(); vector<vector<int>> max_row(n, vector<int>(m, 0)); vector<vector<int>> max_col(n, vector<int>(m, 0)); // Precomputar los máximos en cada fila for (int i = 0; i < n; ++i) { for (int j = 1; j < m - 1; ++j) { max_row[i][j] = max(a[i][j], max_row[i][j - 1]); } } // Precomputar los máximos en cada columna for (int j = 0; j < m; ++j) { for (int i = 1; i < n - 1; ++i) { max_col[i][j] = max(a[i][j], max_col[i - 1][j]); } } ll rec = 0; // Verificar todos los posibles rectángulos for (int i = 1; i < n - 1; ++i) { for (int j = i + 1; j < n - 1; ++j) { for (int k = 1; k < m - 1; ++k) { for (int l = k + 1; l < m - 1; ++l) { bool valid = true; // Verificar las celdas en las filas superior e inferior for (int r = i; r <= j; ++r) { if (max_col[r][k] < a[r][k - 1] || max_col[r][l] < a[r][l + 1]) { valid = false; break; } } if (!valid) continue; // Verificar las celdas en las columnas izquierda y derecha for (int c = k; c <= l; ++c) { if (max_row[i][c] < a[i - 1][c] || max_row[j][c] < a[j + 1][c]) { valid = false; break; } } if (valid) { ++rec; } } } } } return rec; }

Compilation message (stderr)

/usr/bin/ld: /tmp/ccoJSDK4.o: in function `main':
grader.cpp:(.text.startup+0x6fa): undefined reference to `count_rectangles(std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > >)'
collect2: error: ld returned 1 exit status