結果

問題 No.1121 Social Distancing in Cinema
ユーザー butsurizukibutsurizuki
提出日時 2020-07-24 04:20:08
言語 C
(gcc 12.3.0)
結果
WA  
実行時間 -
コード長 1,626 bytes
コンパイル時間 480 ms
コンパイル使用メモリ 30,648 KB
実行使用メモリ 4,508 KB
最終ジャッジ日時 2023-09-06 11:33:13
合計ジャッジ時間 9,403 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,384 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 1 ms
4,384 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 2 ms
4,384 KB
testcase_09 AC 2 ms
4,384 KB
testcase_10 AC 2 ms
4,384 KB
testcase_11 AC 2 ms
4,384 KB
testcase_12 AC 2 ms
4,384 KB
testcase_13 AC 3 ms
4,380 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 15 ms
4,380 KB
testcase_21 AC 12 ms
4,384 KB
testcase_22 AC 12 ms
4,380 KB
testcase_23 AC 5 ms
4,384 KB
testcase_24 AC 4 ms
4,384 KB
testcase_25 AC 126 ms
4,384 KB
testcase_26 AC 166 ms
4,380 KB
testcase_27 AC 8 ms
4,380 KB
testcase_28 WA -
testcase_29 AC 158 ms
4,380 KB
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
testcase_40 AC 84 ms
4,380 KB
testcase_41 AC 24 ms
4,384 KB
testcase_42 WA -
testcase_43 WA -
testcase_44 WA -
testcase_45 WA -
testcase_46 WA -
testcase_47 AC 1 ms
4,384 KB
testcase_48 AC 2 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<stdio.h>
#include<stdbool.h>

int q[1048576];
int qp=0,qqp=0;

void qpush(int x){
    qp++;q[qp]=x;
}

int qpop(){
    qqp++;
    return q[qqp];
}

int dsc[512][512]={0};
int sid[512][512];
int res[524288],rc=0;

bool isvalid(int a,int b){
  if(a<0||a>500){return false;}
  if(b<0||b>500){return false;}
  return true;
}

void rem(int a,int b){
  if(sid[a][b]==-1){return;}
  sid[a][b]=-1;
  int i,j,x,y;
  for(i=-10;i<=10;i++){
    for(j=-10;j<=10;j++){
      if((i*i+j*j)>=100){continue;}
      x=a+i;y=b+j;
      if(isvalid(x,y)){
        dsc[x][y]--;
        if(sid[x][y]!=-1 && dsc[x][y]<=90){
            dsc[x][y]=1000000007;
            qpush(x*512+y);
        }
      }
    }
  }
}

void sit(int a,int b){
  if(sid[a][b]==-1){return;}
  res[rc]=sid[a][b];
  rc++;
  int i,j,x,y;
  for(i=-10;i<=10;i++){
    for(j=-10;j<=10;j++){
      if((i*i+j*j)>=100){continue;}
      x=a+i;y=b+j;
      if(isvalid(x,y)){rem(x,y);}
    }
  }
}

int main(){
  int i,j,k,n,a,b,x,y;
  for(i=0;i<512;i++){
    for(j=0;j<512;j++){sid[i][j]=-1;}
  }
  scanf("%d",&n);
  for(i=1;i<=n;i++){
    scanf("%d%d",&a,&b);
    sid[a][b]=i;
    for(j=-10;j<=10;j++){
      for(k=-10;k<=10;k++){
        if((j*j+k*k)>=100){continue;}
        x=a+j;y=b+k;
        if(isvalid(x,y)){dsc[x][y]++;}
      }
    }
  }
  for(i=0;i<512;i++){
    for(j=0;j<512;j++){
      if(sid[i][j]!=-1 && dsc[i][j]<=90){
        dsc[i][j]=1000000007;
        qpush(i*512+j);
      }
    }
  }
  while(qp!=qqp){
    x=qpop();
    sit(x/512,x%512);
  }
  printf("%d\n",rc);
  for(i=0;i<rc;i++){
    if(i){printf(" ");}
    printf("%d",res[i]);
  }printf("\n");
}
0