1 #include "cstdio"
2 #include "cstring"
3 #include "algorithm"
4
5 using namespace std ;
6 const int maxN = 210 ;
7 const int INF = 2147483647 ;
8
9 bool wat[ maxN ][ maxN ] , map[ maxN ][ maxN ] , used[ maxN ][ maxN ] ;
10
11 int N , M , k , ans , px , py ;
12
13 int from[ maxN ][ maxN ][ 2 ] ;
14
15 int _1[ 5 ] = { 0 , 1 , -1 , 0 , 0 } , _2[ 5 ] = { 0 , 0 , 0 , 1 , -1 } ;//方向
16
17 bool find ( int x , int y )
18 {
19 int px , py ;
20 for(int i=1 ; i<=4 ; ++i )
21 {
22 px = x + _1[i] ,py = y + _2[i];
23 if( px<=0 || px>N || py<=0 || py>M || wat[ px ][ py ] ) continue ;
24 if ( !wat[ px ][ py ] && !used[ px ][ py ] && !map[ px ][ py ])
25 {
26 used[ px ][ py ] = true ;
27 if( ( !from[ px ][ py ][ 0 ] ) || (find( from[ px ][ py ][ 0 ] , from[ px ][ py ][ 1 ] ) ) )
28 {
29 from[ px ][ py ][ 0 ] = x ;
30 from[ px ][ py ][ 1 ] = y ;
31 return true ;
32 }
33 }
34 }
35 return false ;
36 }
37 int main()
38 {
39 scanf( "%d%d%d" , &N , &M , &k ) ;
40 for(int i=1 ; i<=k ; ++i )
41 {
42 int _x , _y ;
43 scanf( "%d%d" , &_x , &_y ) ;
44 wat[ _x ][ _y ] = true ;
45 }
46 for(int i=1 ; i<=N ; ++i )
47 for(int j=1 ; j<=M ; ++j )
48 if((i % 2 && j % 2) || (i%2==0 && j%2==0))map[ i][ j ] = 1 ;
49 for(int i=1 ; i<=N ; ++i )
50 {
51 for(int j=1 ; j<=M ; ++j )
52 {
53 if( !wat[ i ][ j ] && map[ i ][ j ] )
54 {
55 memset ( used, 0 , sizeof ( used ) ) ;
56 if ( find ( i , j ) ) ans++ ;
57 }
58 }
59 }
60 printf( "%d" , ans ) ;
61 return 0 ;
62 }