結果
| 問題 | 
                            No.202 1円玉投げ
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2015-07-21 23:58:15 | 
| 言語 | C++11(廃止可能性あり)  (gcc 13.3.0)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 75 ms / 5,000 ms | 
| コード長 | 1,933 bytes | 
| コンパイル時間 | 1,049 ms | 
| コンパイル使用メモリ | 97,528 KB | 
| 実行使用メモリ | 6,016 KB | 
| 最終ジャッジ日時 | 2024-12-22 09:41:52 | 
| 合計ジャッジ時間 | 3,174 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge2 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 38 | 
ソースコード
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
using namespace std;
class Point
{
public:
    int y, x;
    Point(){
        y = x = 0;
    }
    Point(int y0, int x0){
        y = y0;
        x = x0;
    }
    Point operator+(const Point& p) const{
        return Point(y + p.y, x + p.x);
    }
    Point operator-(const Point& p) const{
        return Point(y - p.y, x - p.x);
    }
    Point operator*(int a) const{
        return Point(y * a, x * a);
    }
    long long length2() const{
        return y * (long long)y + x * (long long)x;
    }
    long long dist2(const Point& p) const{
        return (y - p.y) * (long long)(y - p.y) + (x - p.x) * (long long)(x - p.x);
    }
    long long dot(const Point& p) const{
        return y * (long long)p.y + x * (long long)p.x; // |a|*|b|*cosθ
    }
    long long cross(const Point& p) const{
        return x * (long long)p.y - y * (long long)p.x; // |a|*|b|*sinθ
    }
};
int main()
{
    int n;
    cin >> n;
    int ans = 0;
    vector<vector<vector<Point> > > grid(203, vector<vector<Point> >(203));
    for(int i=0; i<n; ++i){
        Point p;
        cin >> p.x >> p.y;
        int a = p.y / 100 + 1;
        int b = p.x / 100 + 1;
        bool overlap = false;
        for(int j=0; j<9; ++j){
            int a2 = a - 1 + j / 3;
            int b2 = b - 1 + j % 3;
            for(const Point& q : grid[a2][b2]){
                if(p.dist2(q) < 20 * 20)
                    overlap = true;
            }
        }
        if(!overlap){
            ++ ans;
            grid[a][b].push_back(p);
        }
    }
    cout << ans << endl;
    return 0;
}