hiho week 31 register

Ended

Participants:313

Verdict:Accepted
Score:100 / 100
Submitted:2015-02-01 17:24:23

Lang:G++

Edit
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
#include <stdio.h>                    
#include <string.h>
const int MAX=1000;
int N,M;
int o[MAX][MAX],in[MAX][MAX];
int dx[]={-1,0,1,-1,1,-1,0,1},dy[]={-1,-1,-1,0,0,1,1,1},MD=8;
int ddx[]={-2,-1,0,1,2,/**/-2,-1,0,1,2,/**/-2,-1,1,2,/**/-2,-1,0,1,2,/**/-2,-1,0,1,2};
int ddy[]={-2,-2,-2,-2,-2,/**/-1,-1,-1,-1,-1,/**/0,0,0,0,/**/1,1,1,1,1,/**/2,2,2,2,2};
int MDD=24;
int main(){
    //freopen("text.txt","r",stdin);
    int T;
    scanf("%d",&T);
    while(T--){
        scanf("%d%d",&N,&M);
        memset(o,0,sizeof(int )*MAX*MAX);
        memset(in,-1,sizeof(int )*MAX*MAX);
        for(int x=1;x<=N;x++)
            for(int y=1;y<=M;y++)
                scanf("%d",&o[x][y]);
        for(int x=1;x<=N;x++)
            for(int y=1;y<=M;y++){
                if(o[x][y]<0) continue;
                else if(o[x][y]==0)
                    for(int i=0;i<MD;i++)
                        in[x+dx[i]][y+dy[i]]=0;
                else {
                    int no=0,A[MD],B[MD],T[MD],P_A,P_B,S_A=0,S_B,S_T;
                    for(int i=0;i<MD;i++)
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX