diff --git a/06xxx/06080.cpp b/06xxx/06080.cpp new file mode 100644 index 00000000..184796cf --- /dev/null +++ b/06xxx/06080.cpp @@ -0,0 +1,37 @@ +#include +#include +using namespace std; + +int dy[8] = {1, 1, 1, 0, 0, -1, -1, -1}; +int dx[8] = {1, 0, -1, 1, -1, 1, 0, -1}; + +void dfs(int r, int c, vector> &v, int y, int x) { + v[y][x] = 0; + for (int i=0; i<8; i++) { + int ny = y + dy[i], nx = x + dx[i]; + if (ny < 0 || ny >= r || nx < 0 || nx >= c) continue; + if (v[ny][nx]) dfs(r, c, v, ny, nx); + } +} + +void solve(void) { + int r, c; cin >> r >> c; + vector> v(r, vector(c)); + for (int i=0; i> v[i][j]; + + int ans = 0; + for (int i=0; i