結果

問題 No.202 1円玉投げ
ユーザー hogeover30
提出日時 2015-05-12 02:02:38
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
TLE  
実行時間 -
コード長 934 bytes
コンパイル時間 848 ms
コンパイル使用メモリ 72,012 KB
実行使用メモリ 14,976 KB
最終ジャッジ日時 2024-12-22 08:59:42
合計ジャッジ時間 85,622 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 26 TLE * 12
権限があれば一括ダウンロードができます

ソースコード

diff #

#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) {
                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;
    }
}
0