結果

問題 No.202 1円玉投げ
ユーザー e-mon
提出日時 2015-05-06 22:38:02
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 121 ms / 5,000 ms
コード長 1,047 bytes
コンパイル時間 1,897 ms
コンパイル使用メモリ 175,284 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-12-22 08:33:19
合計ジャッジ時間 5,069 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 38
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

typedef vector<int> vi;
typedef pair<int, int> pii;
typedef long long ll;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n)  FOR(i,0,n)

int main(){
    map<pair<int,int>,vector<pair<int,int>> > sqrtMap;
    int N;
    int count = 0;
    cin >> N ;

    FOR(i,0,N){
        int x,y;
        cin >> x >> y ;
        bool add_flag = true;


        for(auto point_pare : (set<pair<int,int>> {make_pair((x+20)/150,(y+20)/150),make_pair((x-20)/150,(y-20)/150),make_pair((x+20)/150,(y-20)/150),make_pair((x-20)/150,(y+20)/150)})){
            for(auto points:sqrtMap[make_pair(point_pare.first,point_pare.second)]){
                if(sqrt(pow(abs(points.first - x),2) + pow(abs(points.second - y),2)) < 20){
                    add_flag = false;
                    break;
                }
            }
        }

        if(add_flag){
            sqrtMap[make_pair(x/150,y/150)].push_back(make_pair(x,y));
            count++;
        }
    }

    cout << count << endl;

    return 0;
}
0