-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbigbrn.cpp
53 lines (49 loc) · 1023 Bytes
/
bigbrn.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/*
ID:naturec1
PROG: bigbrn
LANG: C++
*/
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <string>
#include <iostream>
#include <algorithm>
using namespace std;
#define MEM(a,b) memset(a,b,sizeof(a))
#define REP(i,n) for(int i=0;i<(n);++i)
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define getmid(l,r) ((l) + ((r) - (l)) / 2)
#define MP(a,b) make_pair(a,b)
typedef long long ll;
typedef pair<int,int> pii;
const int INF = (1 << 30) - 1;
int N,T;
bool g[1010][1010];
int dp[1010][1010];
int main(){
freopen("bigbrn.in","r",stdin);
freopen("bigbrn.out","w",stdout);
int a,b;
scanf("%d%d",&N,&T);
REP(i,T){
scanf("%d%d",&a,&b);
g[a][b] = 1;
}
dp[N][N] = !g[a][b];
int ans = 0;
for(int i = N; i >= 1; --i){
for(int j = N; j >= 1; --j) if(!g[i][j]){
dp[i][j] = min(dp[i + 1][j + 1],min(dp[i + 1][j],dp[i][j + 1])) + 1;
ans = max(ans,dp[i][j]);
}
}
printf("%d\n",ans);
return 0;
}