Submission #1065107

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
10651072024-08-18 22:53:14aaaaaarrozRectangles (IOI19_rect)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
bool limites(int n, int m, int x, int y){
return x>=0&&x<n&&y>=0&&y<m;
}
ll count_rectangles(const vector<vector<int>>a) {
ll rect=0;
int n = a.size();
int m = a[0].size();
vector<vector<bool>>v(n,vector<bool>(m));
vector<int>dx={0,-1,0,1};
vector<int>dy={1,0,-1,0};
for(int i=1;i<n-1;i++){
for(int j=1;j<m-1;j++){
if(!visited[i][j]&&a[i][j]==0){
v[i][j]=true;
queue<pair<int,int>>cola;
cola.push({i,j});
int l_x=INT_MAX,r_x=0,l_y=INT_MAX,r_y=0;
int cnt=1;
while(!cola.empty()){
pair<int,int>nodo=cola.front();
cola.pop();
l_x=min(l_x,nodo.first);
r_x=max(r_x,nodo.first);
l_y=min(l_y,nodo.second);
r_y=max(r_y,nodo.second);
for(int i=0;i<4;i++){
int x=nodo.first+dx[i],y=nodo.second+dy[i];
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

rect.cpp: In function 'll count_rectangles(std::vector<std::vector<int> >)':
rect.cpp:16:17: error: 'visited' was not declared in this scope
   16 |             if(!visited[i][j]&&a[i][j]==0){
      |                 ^~~~~~~
rect.cpp:48:12: error: 'rec' was not declared in this scope; did you mean 'rect'?
   48 |     return rec;
      |            ^~~
      |            rect