結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 66 ms
8,204 KB
testcase_01 AC 202 ms
9,892 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 7 ms
4,376 KB
testcase_06 AC 257 ms
8,680 KB
testcase_07 AC 296 ms
9,020 KB
testcase_08 AC 298 ms
9,228 KB
testcase_09 AC 131 ms
7,532 KB
testcase_10 AC 36 ms
5,592 KB
testcase_11 AC 98 ms
6,936 KB
testcase_12 AC 103 ms
6,944 KB
testcase_13 AC 41 ms
5,780 KB
testcase_14 AC 8 ms
4,528 KB
testcase_15 AC 125 ms
7,232 KB
testcase_16 AC 40 ms
8,316 KB
testcase_17 AC 56 ms
8,212 KB
testcase_18 AC 56 ms
8,096 KB
testcase_19 AC 112 ms
7,216 KB
testcase_20 AC 219 ms
8,364 KB
testcase_21 AC 112 ms
7,276 KB
testcase_22 AC 2 ms
4,376 KB
testcase_23 AC 2 ms
4,380 KB
testcase_24 AC 2 ms
4,376 KB
testcase_25 AC 2 ms
4,380 KB
testcase_26 AC 2 ms
4,376 KB
testcase_27 AC 2 ms
4,380 KB
testcase_28 AC 2 ms
4,380 KB
testcase_29 AC 2 ms
4,376 KB
testcase_30 AC 2 ms
4,380 KB
testcase_31 AC 2 ms
4,376 KB
testcase_32 AC 2 ms
4,376 KB
testcase_33 AC 2 ms
4,380 KB
testcase_34 AC 2 ms
4,376 KB
testcase_35 AC 54 ms
8,080 KB
testcase_36 AC 53 ms
8,164 KB
testcase_37 AC 321 ms
9,292 KB
testcase_38 AC 54 ms
8,128 KB
testcase_39 AC 2 ms
4,376 KB
testcase_40 AC 2 ms
4,376 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;
    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;
    }
}
0