욕심쟁이 판다
-
백준 1937번 욕심쟁이 판다PS 2020. 2. 24. 23:52
https://www.acmicpc.net/source/17861879 로그인 www.acmicpc.net dp문제 입니다. 종만북 dp 반쯤 공부하다가 말았는데, 쉬운 난이도는 커버가 되는 느낌이네요 #include #include #include using namespace std; int n, map[501][501]; int cache[501][501]; int dy[4] = { 1, -1, 0, 0 }; int dx[4] = { 0, 0, 1, -1 }; int dfs(int y, int x) { int &res = cache[y][x]; if (res != -1) { return res; } res = 1; for (int i = 0; i < 4; i++) { int ty = y + dy[i]..