結果

問題 No.202 1円玉投げ
ユーザー hogeover30hogeover30
提出日時 2015-05-12 02:15:07
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 322 ms / 5,000 ms
コード長 898 bytes
コンパイル時間 550 ms
コンパイル使用メモリ 71,740 KB
実行使用メモリ 9,888 KB
最終ジャッジ日時 2023-08-23 22:46:29
合計ジャッジ時間 4,848 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 67 ms
8,100 KB
testcase_01 AC 204 ms
9,888 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 7 ms
4,380 KB
testcase_06 AC 250 ms
8,740 KB
testcase_07 AC 290 ms
9,064 KB
testcase_08 AC 293 ms
9,060 KB
testcase_09 AC 129 ms
7,332 KB
testcase_10 AC 35 ms
5,652 KB
testcase_11 AC 96 ms
6,936 KB
testcase_12 AC 101 ms
6,948 KB
testcase_13 AC 41 ms
5,880 KB
testcase_14 AC 8 ms
4,384 KB
testcase_15 AC 122 ms
7,256 KB
testcase_16 AC 39 ms
8,188 KB
testcase_17 AC 55 ms
8,144 KB
testcase_18 AC 56 ms
8,272 KB
testcase_19 AC 111 ms
7,108 KB
testcase_20 AC 214 ms
8,288 KB
testcase_21 AC 111 ms
7,220 KB
testcase_22 AC 2 ms
4,380 KB
testcase_23 AC 2 ms
4,376 KB
testcase_24 AC 1 ms
4,376 KB
testcase_25 AC 2 ms
4,380 KB
testcase_26 AC 2 ms
4,380 KB
testcase_27 AC 2 ms
4,376 KB
testcase_28 AC 1 ms
4,376 KB
testcase_29 AC 2 ms
4,376 KB
testcase_30 AC 3 ms
4,376 KB
testcase_31 AC 1 ms
4,380 KB
testcase_32 AC 3 ms
4,376 KB
testcase_33 AC 2 ms
4,380 KB
testcase_34 AC 2 ms
4,376 KB
testcase_35 AC 53 ms
8,060 KB
testcase_36 AC 53 ms
8,164 KB
testcase_37 AC 322 ms
9,288 KB
testcase_38 AC 54 ms
8,080 KB
testcase_39 AC 1 ms
4,380 KB
testcase_40 AC 2 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

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; cin>>n;
    map<int, set<int>> a;
    for(int $=0;$<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;
}
0