結果

問題 No.202 1円玉投げ
ユーザー tubo28tubo28
提出日時 2015-05-15 02:26:46
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 96 ms / 5,000 ms
コード長 2,299 bytes
コンパイル時間 1,155 ms
コンパイル使用メモリ 149,872 KB
実行使用メモリ 63,812 KB
最終ジャッジ日時 2023-08-23 22:48:48
合計ジャッジ時間 4,961 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 93 ms
62,880 KB
testcase_01 AC 93 ms
63,812 KB
testcase_02 AC 25 ms
61,952 KB
testcase_03 AC 25 ms
62,040 KB
testcase_04 AC 26 ms
61,952 KB
testcase_05 AC 29 ms
62,248 KB
testcase_06 AC 82 ms
63,528 KB
testcase_07 AC 89 ms
63,756 KB
testcase_08 AC 89 ms
63,572 KB
testcase_09 AC 62 ms
63,068 KB
testcase_10 AC 40 ms
62,652 KB
testcase_11 AC 55 ms
62,984 KB
testcase_12 AC 57 ms
63,012 KB
testcase_13 AC 41 ms
62,608 KB
testcase_14 AC 31 ms
62,140 KB
testcase_15 AC 60 ms
63,112 KB
testcase_16 AC 84 ms
63,084 KB
testcase_17 AC 82 ms
63,108 KB
testcase_18 AC 82 ms
63,112 KB
testcase_19 AC 58 ms
62,992 KB
testcase_20 AC 77 ms
63,360 KB
testcase_21 AC 57 ms
62,980 KB
testcase_22 AC 25 ms
62,232 KB
testcase_23 AC 26 ms
62,148 KB
testcase_24 AC 26 ms
62,104 KB
testcase_25 AC 26 ms
62,256 KB
testcase_26 AC 26 ms
61,964 KB
testcase_27 AC 26 ms
62,028 KB
testcase_28 AC 25 ms
61,932 KB
testcase_29 AC 26 ms
62,024 KB
testcase_30 AC 26 ms
62,016 KB
testcase_31 AC 26 ms
61,952 KB
testcase_32 AC 26 ms
62,032 KB
testcase_33 AC 25 ms
61,952 KB
testcase_34 AC 25 ms
62,036 KB
testcase_35 AC 85 ms
62,884 KB
testcase_36 AC 88 ms
62,908 KB
testcase_37 AC 96 ms
63,616 KB
testcase_38 AC 89 ms
63,136 KB
testcase_39 AC 25 ms
61,952 KB
testcase_40 AC 25 ms
61,956 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#define _CRT_SECURE_NO_WARNINGS
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
//#define int ll
//#define endl "\n"
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;
#define all(c) (c).begin(), (c).end()
#define loop(i,a,b) for(ll i=a; i<ll(b); i++)
#define rep(i,b) loop(i,0,b)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
template<class T> ostream & operator<<(ostream & os, vector<T> const &);
template<int n, class...T> typename enable_if<(n>=sizeof...(T))>::type _ot(ostream &, tuple<T...> const &){}
template<int n, class...T> typename enable_if<(n< sizeof...(T))>::type _ot(ostream & os, tuple<T...> const & t){ os << (n==0?"":" ") << get<n>(t); _ot<n+1>(os, t); }
template<class...T> ostream & operator<<(ostream & os, tuple<T...> const & t){ _ot<0>(os, t); return os; }
template<class T, class U> ostream & operator<<(ostream & os, pair<T,U> const & p){ return os << "(" << p.first << ", " << p.second << ") "; }
template<class T> ostream & operator<<(ostream & os, vector<T> const & v){ rep(i,v.size()) os << v[i] << (i+1==(int)v.size()?"":" "); return os; }
template<class T> inline bool chmax(T & x, T const & y){ return x<y ? x=y,true : false; }
template<class T> inline bool chmin(T & x, T const & y){ return x>y ? x=y,true : false; }
#ifdef DEBUG
#define dump(...) (cerr<<#__VA_ARGS__<<" = "<<mt(__VA_ARGS__)<<" ["<<__LINE__<<"]"<<endl)
#else
#define dump(...)
#endif
// ll const mod = 1000000007;
// ll const inf = 1LL<<60;

int N;
int const l = 80;
vector<pair<int,int>> baq[40010/l][400010/l];

bool check(int x, int y){
    int bx = x/l, by = y/l;
    for(int i=by-1;i<=by+1;i++){
        for(int j=bx-1;j<=bx+1;j++){
            for(auto & p : baq[i][j]){
                int cx, cy;
                tie(cx,cy) = p;
                int dx = x-cx, dy = y-cy;
                int d2 = dx*dx + dy*dy;
                if(d2 < 400) return false;
            }
        }
    }
    return true;
}

int main(){
    cin >> N;
    int ans = 0;
    rep(i,N){
        int x,y;
        cin >> x >> y;
        x += l;
        y += l;
        if(!check(x,y)) continue;
        baq[y/l][x/l].eb(x,y);
        ans++;
    }
    cout << ans << endl;
}
0