結果

問題 No.202 1円玉投げ
ユーザー firiexpfiriexp
提出日時 2019-11-18 14:04:36
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 221 ms / 5,000 ms
コード長 1,606 bytes
コンパイル時間 895 ms
コンパイル使用メモリ 100,912 KB
実行使用メモリ 199,004 KB
最終ジャッジ日時 2023-08-24 00:04:38
合計ジャッジ時間 9,902 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 205 ms
198,884 KB
testcase_01 AC 221 ms
198,732 KB
testcase_02 AC 146 ms
198,884 KB
testcase_03 AC 145 ms
198,688 KB
testcase_04 AC 146 ms
198,792 KB
testcase_05 AC 151 ms
198,732 KB
testcase_06 AC 208 ms
198,932 KB
testcase_07 AC 216 ms
198,908 KB
testcase_08 AC 216 ms
198,884 KB
testcase_09 AC 187 ms
198,688 KB
testcase_10 AC 162 ms
198,820 KB
testcase_11 AC 179 ms
198,680 KB
testcase_12 AC 179 ms
198,796 KB
testcase_13 AC 164 ms
198,740 KB
testcase_14 AC 150 ms
198,968 KB
testcase_15 AC 184 ms
198,732 KB
testcase_16 AC 195 ms
199,004 KB
testcase_17 AC 195 ms
198,796 KB
testcase_18 AC 197 ms
198,872 KB
testcase_19 AC 180 ms
198,936 KB
testcase_20 AC 202 ms
198,692 KB
testcase_21 AC 181 ms
198,812 KB
testcase_22 AC 150 ms
198,748 KB
testcase_23 AC 146 ms
198,812 KB
testcase_24 AC 146 ms
198,896 KB
testcase_25 AC 146 ms
198,952 KB
testcase_26 AC 146 ms
198,796 KB
testcase_27 AC 146 ms
198,864 KB
testcase_28 AC 147 ms
198,684 KB
testcase_29 AC 146 ms
198,972 KB
testcase_30 AC 147 ms
198,932 KB
testcase_31 AC 145 ms
198,816 KB
testcase_32 AC 146 ms
198,688 KB
testcase_33 AC 146 ms
198,872 KB
testcase_34 AC 144 ms
198,692 KB
testcase_35 AC 194 ms
198,812 KB
testcase_36 AC 205 ms
198,880 KB
testcase_37 AC 221 ms
198,684 KB
testcase_38 AC 196 ms
198,692 KB
testcase_39 AC 145 ms
198,792 KB
testcase_40 AC 146 ms
198,948 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <iomanip>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>
#include <limits>


static const int MOD = 1000000007;
using ll = long long;
using u32 = uint32_t;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max() / 32 * 15 + 208;

template <class T, class U>
vector<T> make_v(U size, const T& init){ return vector<T>(static_cast<size_t>(size), init); }

template<class... Ts, class U>
auto make_v(U size, Ts... rest) { return vector<decltype(make_v(rest...))>(static_cast<size_t>(size), make_v(rest...)); }

template<class T> void chmin(T &a, const T &b){ a = (a < b ? a : b); }
template<class T> void chmax(T &a, const T &b){ a = (a > b ? a : b); }

int main() {
    auto dp = make_v(5004, 5004, make_pair(-1, -1));
    int n;
    cin >> n;
    pair<int, int> D = {-1, -1};
    int ans = 0;
    for (int i = 0; i < n; ++i) {
        int x, y;
        cin >> x >> y;
        int ok = 1;
        int xx = x/10+2, yy = y/10+2;
        for (int dx = -2; dx <= 2; ++dx) {
            for (int dy = -2; dy <= 2; ++dy) {
                if(dp[xx+dx][yy+dy] != D){
                    int px, py;
                    tie(px, py) = dp[xx+dx][yy+dy];
                    if((px-x)*(px-x)+(py-y)*(py-y) < 400){
                        ok = 0;
                        dx = 3, dy = 3;
                        break;
                    }
                }
            }
        }
        if(ok) ans++, dp[xx][yy] = {x, y};
    }
    cout << ans << "\n";
    return 0;
}
0