結果

問題 No.202 1円玉投げ
ユーザー tubo28tubo28
提出日時 2015-05-15 02:29:45
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 214 ms / 5,000 ms
コード長 2,300 bytes
コンパイル時間 1,192 ms
コンパイル使用メモリ 149,944 KB
実行使用メモリ 381,056 KB
最終ジャッジ日時 2023-08-23 22:49:17
合計ジャッジ時間 10,191 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 208 ms
379,856 KB
testcase_01 AC 213 ms
381,056 KB
testcase_02 AC 148 ms
378,340 KB
testcase_03 AC 147 ms
378,356 KB
testcase_04 AC 147 ms
378,432 KB
testcase_05 AC 154 ms
378,812 KB
testcase_06 AC 205 ms
380,368 KB
testcase_07 AC 210 ms
380,576 KB
testcase_08 AC 211 ms
380,552 KB
testcase_09 AC 179 ms
379,788 KB
testcase_10 AC 160 ms
378,984 KB
testcase_11 AC 175 ms
379,504 KB
testcase_12 AC 175 ms
379,532 KB
testcase_13 AC 163 ms
379,176 KB
testcase_14 AC 150 ms
378,628 KB
testcase_15 AC 178 ms
379,696 KB
testcase_16 AC 200 ms
380,004 KB
testcase_17 AC 199 ms
380,076 KB
testcase_18 AC 199 ms
379,900 KB
testcase_19 AC 178 ms
379,792 KB
testcase_20 AC 197 ms
380,188 KB
testcase_21 AC 178 ms
379,680 KB
testcase_22 AC 148 ms
378,416 KB
testcase_23 AC 144 ms
378,672 KB
testcase_24 AC 148 ms
378,412 KB
testcase_25 AC 145 ms
378,636 KB
testcase_26 AC 147 ms
378,512 KB
testcase_27 AC 146 ms
378,396 KB
testcase_28 AC 145 ms
378,376 KB
testcase_29 AC 145 ms
378,352 KB
testcase_30 AC 145 ms
378,412 KB
testcase_31 AC 144 ms
378,396 KB
testcase_32 AC 149 ms
378,372 KB
testcase_33 AC 146 ms
378,380 KB
testcase_34 AC 147 ms
378,512 KB
testcase_35 AC 201 ms
379,748 KB
testcase_36 AC 205 ms
379,876 KB
testcase_37 AC 214 ms
380,616 KB
testcase_38 AC 204 ms
379,788 KB
testcase_39 AC 144 ms
378,548 KB
testcase_40 AC 147 ms
378,344 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 = 50;
vector<pair<int,int>> baq[200010/l][200010/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