結果

問題 No.202 1円玉投げ
ユーザー tailstails
提出日時 2015-04-19 20:23:59
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 89 ms / 5,000 ms
コード長 923 bytes
コンパイル時間 2,763 ms
コンパイル使用メモリ 144,736 KB
実行使用メモリ 27,136 KB
最終ジャッジ日時 2023-08-23 21:24:27
合計ジャッジ時間 6,568 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 60 ms
8,452 KB
testcase_01 AC 84 ms
26,916 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 27 ms
23,840 KB
testcase_06 AC 76 ms
27,000 KB
testcase_07 AC 82 ms
26,864 KB
testcase_08 AC 84 ms
26,872 KB
testcase_09 AC 57 ms
27,136 KB
testcase_10 AC 40 ms
26,932 KB
testcase_11 AC 52 ms
27,040 KB
testcase_12 AC 53 ms
26,868 KB
testcase_13 AC 41 ms
26,856 KB
testcase_14 AC 29 ms
24,756 KB
testcase_15 AC 58 ms
26,996 KB
testcase_16 AC 53 ms
6,716 KB
testcase_17 AC 57 ms
10,640 KB
testcase_18 AC 56 ms
10,620 KB
testcase_19 AC 53 ms
26,940 KB
testcase_20 AC 70 ms
26,832 KB
testcase_21 AC 54 ms
26,876 KB
testcase_22 AC 2 ms
4,376 KB
testcase_23 AC 2 ms
4,380 KB
testcase_24 AC 2 ms
4,380 KB
testcase_25 AC 2 ms
4,376 KB
testcase_26 AC 6 ms
7,320 KB
testcase_27 AC 6 ms
7,332 KB
testcase_28 AC 2 ms
4,380 KB
testcase_29 AC 2 ms
4,380 KB
testcase_30 AC 6 ms
6,992 KB
testcase_31 AC 2 ms
4,380 KB
testcase_32 AC 10 ms
10,052 KB
testcase_33 AC 3 ms
4,376 KB
testcase_34 AC 2 ms
4,376 KB
testcase_35 AC 58 ms
9,652 KB
testcase_36 AC 56 ms
5,784 KB
testcase_37 AC 89 ms
26,936 KB
testcase_38 AC 62 ms
9,704 KB
testcase_39 AC 2 ms
4,380 KB
testcase_40 AC 1 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

int grid[1002][1002][6];

int sq(int x){
  return x*x;
}

bool check1(int x0,int y0,int* g){
  for(int i=0;g[i];++i){
    int x1=g[i]>>1&0x7fff;
    int y1=g[i]>>16&0x7fff;
    if(sq(x1-x0)+sq(y1-y0)<400){
      return false;
    }
  }
  return true;
}

bool check(int x,int y){
  return check1(x,y,grid[y/20][x/20])&&
    check1(x,y,grid[y/20][x/20+1])&&
    check1(x,y,grid[y/20+1][x/20])&&
    check1(x,y,grid[y/20+1][x/20+1]);
}

void add1(int x,int y,int* g){
  int i=0;
  while(g[i])++i;
  g[i]=1|x<<1|y<<16;
}

void add(int x,int y){
  add1(x,y,grid[y/20][x/20]);
  add1(x,y,grid[y/20][x/20+1]);
  add1(x,y,grid[y/20+1][x/20]);
  add1(x,y,grid[y/20+1][x/20+1]);
}

int main() {
  int count=0;
  int n;
  std::cin >> n;
  for(int i=0;i<n;++i){
    int x,y;
    std::cin >> x >> y;
    if(check(x,y)){
      add(x,y);
      ++count;
    }
  }
  std::cout << count << std::endl;
  return 0;
}
0