#include "aliens.h"
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
using namespace std;
typedef long long ll;
const int maxn=105;
int n, m, k;
bool bio[maxn][maxn];
void dfs(int x, int y){
assert(x<m && y<m);
if(bio[x][y]){
return;
}
bio[x][y]=1;
if(x==y){
return;
}
dfs(x+1, y);
dfs(x, y-1);
}
void dfs2(int x, int y){
assert(x<m && y<m);
if(bio[x][y]){
return;
}
bio[x][y]=1;
if(x==y){
return;
}
dfs(x-1, y);
dfs(x, y+1);
}
ll take_photos(int nn, int mm, int kk, vector < int > r, vector < int > c){
n=nn;
m=mm;
k=kk;
for(int i=0; i<n; i++){
dfs(min(r[i], c[i]), max(r[i], c[i]));
dfs2(max(r[i], c[i]), min(r[i], c[i]));
}
ll pov=0;
for(int i=0; i<m; i++){
for(int j=0; j<m; j++){
if(bio[i][j]){
pov++;
}
}
}
return pov;
}
Compilation message
aliens.cpp: In function 'void dfs(int, int)':
aliens.cpp:18:2: error: 'assert' was not declared in this scope
18 | assert(x<m && y<m);
| ^~~~~~
aliens.cpp:5:1: note: 'assert' is defined in header '<cassert>'; did you forget to '#include <cassert>'?
4 | #include <algorithm>
+++ |+#include <cassert>
5 | #include <vector>
aliens.cpp: In function 'void dfs2(int, int)':
aliens.cpp:31:2: error: 'assert' was not declared in this scope
31 | assert(x<m && y<m);
| ^~~~~~
aliens.cpp:31:2: note: 'assert' is defined in header '<cassert>'; did you forget to '#include <cassert>'?