結果

問題 No.202 1円玉投げ
ユーザー k
提出日時 2021-03-08 03:15:57
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 248 ms / 5,000 ms
コード長 809 bytes
コンパイル時間 1,904 ms
コンパイル使用メモリ 192,084 KB
最終ジャッジ日時 2025-01-19 12:53:07
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 38
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

int bd[8000][8000];
int xs[100000];
int ys[100000];

int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);

  memset(bd, -1, sizeof(bd));  
  int n;
  cin >> n;

  int ret = 0;
  for (int i = 0; i < n; i++) {
    cin >> xs[i] >> ys[i];

    bool hit = false;
    for (int bx = xs[i]/14 - 2; bx <= xs[i]/14 + 2; bx++) {
      for (int by = ys[i]/14 - 2; by <= ys[i]/14 + 2; by++) {
        if (bx < 0 || by < 0) continue;
        int j = bd[bx][by];
        if (j != -1) {
          int dist = (xs[i] - xs[j]) * (xs[i] - xs[j]) + (ys[i] - ys[j]) * (ys[i] - ys[j]);
          if (dist < 20 * 20)
            hit = true;
        }
      }
    }
    if (!hit) {
      ++ret;
      bd[xs[i]/14][ys[i]/14] = i;
    }
  }

  cout << ret << endl;
  
  return 0;
}
0