結果

問題 No.202 1円玉投げ
ユーザー mamekinmamekin
提出日時 2015-07-21 23:58:15
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 79 ms / 5,000 ms
コード長 1,933 bytes
コンパイル時間 747 ms
コンパイル使用メモリ 97,060 KB
実行使用メモリ 6,432 KB
最終ジャッジ日時 2023-08-23 23:06:33
合計ジャッジ時間 3,660 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 78 ms
5,496 KB
testcase_01 AC 74 ms
6,432 KB
testcase_02 AC 3 ms
4,380 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 7 ms
4,548 KB
testcase_06 AC 62 ms
5,664 KB
testcase_07 AC 70 ms
5,744 KB
testcase_08 AC 71 ms
5,828 KB
testcase_09 AC 40 ms
5,292 KB
testcase_10 AC 18 ms
4,868 KB
testcase_11 AC 33 ms
5,208 KB
testcase_12 AC 34 ms
5,464 KB
testcase_13 AC 19 ms
4,888 KB
testcase_14 AC 7 ms
4,536 KB
testcase_15 AC 38 ms
5,292 KB
testcase_16 AC 65 ms
5,672 KB
testcase_17 AC 67 ms
5,604 KB
testcase_18 AC 67 ms
5,608 KB
testcase_19 AC 36 ms
5,312 KB
testcase_20 AC 58 ms
5,540 KB
testcase_21 AC 37 ms
5,288 KB
testcase_22 AC 3 ms
4,472 KB
testcase_23 AC 3 ms
4,596 KB
testcase_24 AC 3 ms
4,380 KB
testcase_25 AC 3 ms
4,380 KB
testcase_26 AC 3 ms
4,444 KB
testcase_27 AC 3 ms
4,380 KB
testcase_28 AC 3 ms
4,384 KB
testcase_29 AC 3 ms
4,532 KB
testcase_30 AC 3 ms
4,476 KB
testcase_31 AC 3 ms
4,376 KB
testcase_32 AC 3 ms
4,540 KB
testcase_33 AC 3 ms
4,536 KB
testcase_34 AC 3 ms
4,416 KB
testcase_35 AC 70 ms
5,420 KB
testcase_36 AC 74 ms
5,528 KB
testcase_37 AC 79 ms
6,036 KB
testcase_38 AC 73 ms
5,420 KB
testcase_39 AC 2 ms
4,380 KB
testcase_40 AC 2 ms
4,612 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(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;
}
0