結果

問題 No.1121 Social Distancing in Cinema
ユーザー butsurizukibutsurizuki
提出日時 2020-07-24 04:31:24
言語 C
(gcc 12.3.0)
結果
RE  
実行時間 -
コード長 1,665 bytes
コンパイル時間 955 ms
コンパイル使用メモリ 30,592 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-06 11:50:28
合計ジャッジ時間 13,075 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include<stdio.h>
#include<stdbool.h>
#include<assert.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);
  assert(rc*90>=n);
  for(i=0;i<rc;i++){
    if(i){printf(" ");}
    printf("%d",res[i]);
  }printf("\n");
}
0