結果

問題 No.202 1円玉投げ
コンテスト
ユーザー beet
提出日時 2019-04-25 18:05:28
言語 C++17
(gcc 15.2.0 + boost 1.90.0)
コンパイル:
g++-15 -O2 -lm -std=c++17 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 2,683 ms / 5,000 ms
コード長 780 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,803 ms
コンパイル使用メモリ 219,020 KB
実行使用メモリ 8,116 KB
最終ジャッジ日時 2026-06-07 11:22:20
合計ジャッジ時間 33,040 ms
ジャッジサーバーID
(参考情報)
judge1_1 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 38
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include<bits/stdc++.h>
using namespace std;
using Int = long long;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}


//INSERT ABOVE HERE
signed main(){
  Int n;
  cin>>n;

  auto calc=[&](Int x,Int y){return (x+1000)*30000+(y+1000);};
  unordered_set<Int> sp;

  using P = pair<Int,Int>;
  vector<P> dz;
  for(Int i=-100;i<=100;i++)
    for(Int j=-100;j<=100;j++)
      if(i*i+j*j<400) dz.emplace_back(i,j);
  
  Int cnt=0;
  for(Int i=0;i<n;i++){
    Int x,y;
    cin>>x>>y;

    Int flg=0;    
    for(auto p:dz)
      flg|=sp.count(calc(x+p.first,y+p.second));
      
    if(flg) continue;
    cnt++;
    sp.emplace(calc(x,y));
  }
  
  cout<<cnt<<endl;
  return 0;
}
0