結果
| 問題 |
No.202 1円玉投げ
|
| コンテスト | |
| ユーザー |
hogeover30
|
| 提出日時 | 2015-05-12 02:03:54 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 338 ms / 5,000 ms |
| コード長 | 980 bytes |
| コンパイル時間 | 1,005 ms |
| コンパイル使用メモリ | 72,076 KB |
| 実行使用メモリ | 9,856 KB |
| 最終ジャッジ日時 | 2024-12-22 09:01:32 |
| 合計ジャッジ時間 | 5,348 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 38 |
ソースコード
#include <iostream>
#include <set>
#include <map>
using namespace std;
bool is_overlap(int x0, int y0, int x1, int y1)
{
#define sq(x) ((x)*(x))
#define dist(a, b, c, d) (sq(a-c)+sq(b-d))
return dist(x0, y0, x1, y1)<400;
}
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
int n;
while (cin>>n) {
map<int, set<int>> a;
while (n--) {
int x, y; cin>>x>>y;
bool overlap=false;
for(auto i=a.lower_bound(x-20);i!=a.end();++i) {
if (i->first-20>=x+20) break;
auto& b=i->second;
for(auto j=b.lower_bound(y-20);j!=b.end();++j) {
if (*j-20>=y+20) break;
if (overlap=is_overlap(x, y, i->first, *j)) break;
}
if (overlap) break;
}
if (!overlap) a[x].insert(y);
}
int res=0;
for(auto&v: a) res+=v.second.size();
cout<<res<<endl;
}
}
hogeover30