如何离散化!
查看原帖
如何离散化!
558597
MujicaSaki摸鱼楼主2022/6/14 10:48

求助qwq

#include<bits/stdc++.h>
using namespace std;
int n,t,x,y,dp[5005][5005],maxn,s;
bool a[5005][5005];
int main(){
cin>>n>>t;
for(int i=1;i<=t;i++){
cin>>x>>y;
a[x][y]=1;
}
for(int i=1;i<=n;i++){
    for(int j=1;j<=n;j++){
    if(i==0||j==0){
    if(a[i][j]==0) dp[i][j]=1;
    maxn=max(maxn,dp[i][j]);
    }
    else if(a[i][j]==0){
        s=min(dp[i-1][j],min(dp[i][j-1],dp[i-1][j-1]));
        dp[i][j]=(int)pow(sqrt(s)+1,2);
        maxn=max(maxn,dp[i][j]);
    }
    }
}
cout<<sqrt(maxn);
}
2022/6/14 10:48
加载中...