結果

問題 No.202 1円玉投げ
ユーザー akakimidoriakakimidori
提出日時 2018-08-30 04:26:26
言語 C90
(gcc 11.4.0)
結果
AC  
実行時間 67 ms / 5,000 ms
コード長 947 bytes
コンパイル時間 1,229 ms
コンパイル使用メモリ 25,116 KB
実行使用メモリ 33,216 KB
最終ジャッジ日時 2023-08-23 23:56:03
合計ジャッジ時間 3,879 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
33,092 KB
testcase_01 AC 67 ms
33,008 KB
testcase_02 AC 12 ms
33,100 KB
testcase_03 AC 12 ms
33,064 KB
testcase_04 AC 12 ms
33,216 KB
testcase_05 AC 15 ms
33,208 KB
testcase_06 AC 57 ms
33,096 KB
testcase_07 AC 64 ms
33,124 KB
testcase_08 AC 64 ms
33,100 KB
testcase_09 AC 40 ms
33,140 KB
testcase_10 AC 24 ms
33,216 KB
testcase_11 AC 36 ms
33,008 KB
testcase_12 AC 36 ms
33,092 KB
testcase_13 AC 25 ms
33,204 KB
testcase_14 AC 16 ms
33,092 KB
testcase_15 AC 39 ms
33,092 KB
testcase_16 AC 34 ms
33,012 KB
testcase_17 AC 35 ms
33,088 KB
testcase_18 AC 34 ms
33,140 KB
testcase_19 AC 38 ms
33,148 KB
testcase_20 AC 54 ms
33,064 KB
testcase_21 AC 36 ms
33,104 KB
testcase_22 AC 13 ms
33,128 KB
testcase_23 AC 13 ms
33,088 KB
testcase_24 AC 12 ms
33,132 KB
testcase_25 AC 12 ms
33,012 KB
testcase_26 AC 11 ms
33,128 KB
testcase_27 AC 12 ms
33,128 KB
testcase_28 AC 12 ms
33,128 KB
testcase_29 AC 12 ms
33,092 KB
testcase_30 AC 13 ms
33,152 KB
testcase_31 AC 12 ms
33,128 KB
testcase_32 AC 11 ms
33,148 KB
testcase_33 AC 11 ms
33,204 KB
testcase_34 AC 12 ms
33,008 KB
testcase_35 AC 35 ms
33,204 KB
testcase_36 AC 39 ms
33,140 KB
testcase_37 AC 67 ms
33,096 KB
testcase_38 AC 36 ms
33,204 KB
testcase_39 AC 12 ms
33,216 KB
testcase_40 AC 11 ms
33,212 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<stdio.h>
#include<stdlib.h>

#define M 2000

#define POS(i,j) ((i)*(M+1)+(j))

typedef struct point2d{
  int x,y;
} point;

int distance(const point *a,const point *b){
  int dx=a->x-b->x;
  int dy=a->y-b->y;
  return dx*dx+dy*dy;
}

void run(void){
  int n;
  scanf("%d",&n);
  const int m=M;
  point *bucket=(point *)calloc((m+1)*(m+1),sizeof(point));
  int i,j;
  for(i=0;i<=m;i++){
    for(j=0;j<=m;j++){
      bucket[POS(i,j)].x=-20;
      bucket[POS(i,j)].y=-20;
    }
  }
  int cnt=0;
  while(n--){
    point t;
    scanf("%d%d",&t.x,&t.y);
    int x=t.x/10;
    int y=t.y/10;
    int flag=1;
    int i,j;
    for(i=-2;i<=2;i++){
      if(!(0<=x+i && x+i<=m)) continue;
      for(j=-2;j<=2;j++){
	if(!(0<=y+j && y+j<=m)) continue;
	if(distance(bucket+POS(x+i,y+j),&t)<20*20){
	  flag=0;
	}
      }
    }
    if(flag){
      cnt++;
      bucket[POS(x,y)]=t;
    }
  }
  printf("%d\n",cnt);
}

int main(void){
  run();
  return 0;
}
0