結果

問題 No.202 1円玉投げ
ユーザー mamekinmamekin
提出日時 2015-07-21 23:57:05
言語 C++11
(gcc 11.4.0)
結果
RE  
実行時間 -
コード長 1,933 bytes
コンパイル時間 765 ms
コンパイル使用メモリ 96,552 KB
実行使用メモリ 5,540 KB
最終ジャッジ日時 2023-08-23 23:06:29
合計ジャッジ時間 6,550 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 RE -
testcase_02 AC 3 ms
4,380 KB
testcase_03 AC 3 ms
4,380 KB
testcase_04 AC 3 ms
4,380 KB
testcase_05 RE -
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 AC 7 ms
4,568 KB
testcase_15 RE -
testcase_16 AC 67 ms
5,512 KB
testcase_17 AC 67 ms
5,528 KB
testcase_18 AC 67 ms
5,540 KB
testcase_19 RE -
testcase_20 RE -
testcase_21 RE -
testcase_22 AC 3 ms
4,376 KB
testcase_23 RE -
testcase_24 RE -
testcase_25 RE -
testcase_26 AC 3 ms
4,392 KB
testcase_27 RE -
testcase_28 RE -
testcase_29 RE -
testcase_30 RE -
testcase_31 AC 3 ms
4,376 KB
testcase_32 AC 3 ms
4,636 KB
testcase_33 RE -
testcase_34 AC 3 ms
4,472 KB
testcase_35 AC 69 ms
5,460 KB
testcase_36 RE -
testcase_37 RE -
testcase_38 AC 75 ms
5,440 KB
testcase_39 AC 3 ms
4,380 KB
testcase_40 AC 3 ms
4,384 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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(202, vector<vector<Point> >(202));
    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;
}
0