cf 505c Mr. Kitayuta, the Treasure Hunter
来源:互联网 发布:知乐的全部小说目录 编辑:程序博客网 时间:2024/06/05 15:07
#include <cstdio>#include <cstring>#include <algorithm>#include <cmath>#include <queue>#include <map>#include <vector>using namespace std;const int maxn = 30015;int n, d, vis[maxn], dp[maxn][500];int dfs(int u, int cha){ if (u > 30000) return 0; if (dp[u][cha] != -1) return dp[u][cha]; int tmp = d + cha - 250; dp[u][cha] = vis[u]; int ans = 0; if (tmp > 1) ans = max(ans, dfs(u + tmp - 1, cha - 1)); ans = max(ans, dfs(u + tmp, cha)); ans = max(ans, dfs(u + tmp + 1, cha + 1)); dp[u][cha] += ans; return dp[u][cha];}int main(){ scanf("%d%d", &n, &d); int tmp; for (int i = 0; i < n; i++) { scanf("%d", &tmp); vis[tmp]++; } memset(dp, -1, sizeof(dp)); printf("%d\n", dfs(d, 250)); return 0;}
0 0
- cf 505c Mr. Kitayuta, the Treasure Hunter
- dp cf C. Mr. Kitayuta, the Treasure Hunter
- CF 505C(Mr. Kitayuta, the Treasure Hunter-Dp考虑可用范围)
- codeforces 505C C. Mr. Kitayuta, the Treasure Hunter (dp)
- codeforces 505C Mr. Kitayuta, the Treasure Hunter(dp)
- codeforces 505C Mr. Kitayuta, the Treasure Hunter(DP)
- CodeForces 505C Mr. Kitayuta, the Treasure Hunter
- CodeForces-505C Mr. Kitayuta, the Treasure Hunter
- codeforces 505C Mr. Kitayuta, the Treasure Hunter
- codeforces 505C Mr. Kitayuta, the Treasure Hunter(DP)
- Mr. Kitayuta, the Treasure Hunter
- CF 286DIV2 C. Mr. Kitayuta, the Treasure Hunter(dp)
- cf#186-C. Mr. Kitayuta, the Treasure Hunter-dp(预推断+offset)
- Codeforces Round #286 C. Mr. Kitayuta, the Treasure Hunter dp
- #286 (Div. 2) C. Mr. Kitayuta, the Treasure Hunter
- cf286C Mr. Kitayuta, the Treasure Hunter dp
- CF_505C Mr. Kitayuta, the Treasure Hunter
- dp Codeforces505C Mr. Kitayuta, the Treasure Hunter
- ACM 进阶之路
- 智力游戏(搬山游戏)
- Eclipse编写C++出现Symbol 'std' could not be resolved错误提示的解决方案
- cf 505d Mr. Kitayuta's Technology
- 浅谈select与epoll函数
- cf 505c Mr. Kitayuta, the Treasure Hunter
- CXF整合spring(客户端)
- 使用unity3d需要注意到细节
- Why doesn't RecyclerView have onItemClickListener()? and How RecyclerView is different from Listview
- Android studio 安装中遇到一些问题的解决办法,分享一下
- C++ 函数参数传递-传递指向指针的引用
- MFC仿360屏幕截图
- 物联网 移动国家代码 以及 移动网络代码
- 【GoLang笔记】A Tour of Go - Exercise: Equivalent Binary Trees