結果

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

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

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

  int n;
  cin >> n;

  set<pair<int, int> > st;
  for (int i = 0; i < n; i++) {
    int x, y;
    cin >> x >> y;
    bool hit = false;
    if (st.size()) {
      auto itr = st.lower_bound(make_pair(x - 20, 0));
      while (itr != st.end()) {
        int xt = itr->first;
        int yt = itr->second;
        if (xt > x + 20)
          break;
        int dist = (x - xt) * (x - xt) + (y - yt) * (y - yt);
        if (dist < 20 * 20)
          hit = true;
        ++itr;
      }
    }
    if (!hit)
      st.emplace(x, y);
  }

  cout << st.size() << endl;
  
  return 0;
}
0