TLE自动机 @ 2018-04-13 13:48:08
#include<iostream>
#include<queue>
using namespace std;
struct node{
int i,j,num,f;
};
struct cmp1{
bool operator()(node x,node y){
return x.num>y.num;
}
};
priority_queue<node,vector<node>,cmp1>q;
int n,m,maxn,maxj,maxi,w,top=0,g[101][101],f[101][101];
int main(){
cin>>n>>m;
for(int i=1;i<=n;i++){
for(int j=1;j<=m;j++){
cin>>g[i][j];
node a;
a.i=i;a.j=j;a.f=0;a.num=g[i][j];
q.push(a);
top++;
}
}
while(!q.empty()){
node now1=q.top();
int i=now1.i;
int j=now1.j;
int now=now1.num;
q.pop();
if(g[i-1][j]<now) f[i][j]=max(f[i][j],f[i-1][j]+1);
if(g[i+1][j]<now) f[i][j]=max(f[i][j],f[i+1][j]+1);
if(g[i][j-1]<now) f[i][j]=max(f[i][j],f[i][j-1]+1);
if(g[i][j+1]<now) f[i][j]=max(f[i][j],f[i][j+1]+1);
if(maxn<f[i][j]) maxn=f[i][j];
}
cout<<maxn;
return 0;
}
感谢!
by Parabola @ 2018-04-13 14:04:22
一拳一个...抱歉...
by strangers @ 2018-04-13 14:13:06
一拳一个...抱歉...
by Ameyax @ 2018-04-13 15:43:44
一拳一个嘤嘤怪?