社区讨论
样例过了,但是10分,求助!
P2285[HNOI2004] 打鼹鼠参与者 1已保存回复 0
讨论操作
快速查看讨论及其快照的属性,并进行相关操作。
- 当前回复
- 0 条
- 当前快照
- 1 份
- 快照标识符
- @lq3j3gh7
- 此快照首次捕获于
- 2023/12/13 16:47 2 年前
- 此快照最后确认于
- 2023/12/13 16:50 2 年前
CPP
// Problem:
// P2285 [HNOI2004] 打鼹鼠
//
// Contest: Luogu
// URL: https://www.luogu.com.cn/problem/P2285
// Memory Limit: 125 MB
// Time Limit: 1000 ms
//
// Powered by CP Editor (https://cpeditor.org)
#include<iostream>
#include<algorithm>
#include<cstring>
using namespace std;
const int N=1005;
int f1[N][N]; //存储放变化
int f2[N][N]; //结果
int n,m;
int ans;
bool check=true;
int main(){
cin>>n>>m;
int pre;
int now;
int x,y;
while(n--){
cin>>now;
if(check) pre=now,check=false;
if(now!=pre) memcpy(f1, f2, sizeof f2);
cin>>x>>y;
f2[x][y]=max(max(f1[x-1][y],f1[x][y-1]),max(f1[x+1][y],f1[x][y+1]))+1;
pre=now;
ans=max(ans,f2[x][y]);
}
cout<<ans<<endl;
return 0;
}
回复
共 0 条回复,欢迎继续交流。
正在加载回复...