結果

問題 No.202 1円玉投げ
ユーザー commycommy
提出日時 2021-03-22 01:13:24
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 825 ms / 5,000 ms
コード長 2,016 bytes
コンパイル時間 574 ms
コンパイル使用メモリ 77,316 KB
実行使用メモリ 394,676 KB
最終ジャッジ日時 2023-08-24 00:21:38
合計ジャッジ時間 14,449 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 320 ms
159,844 KB
testcase_01 AC 740 ms
394,432 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 2 ms
5,772 KB
testcase_05 AC 311 ms
372,412 KB
testcase_06 AC 780 ms
394,500 KB
testcase_07 AC 814 ms
394,676 KB
testcase_08 AC 789 ms
394,376 KB
testcase_09 AC 618 ms
394,612 KB
testcase_10 AC 422 ms
394,400 KB
testcase_11 AC 527 ms
394,564 KB
testcase_12 AC 535 ms
394,372 KB
testcase_13 AC 430 ms
394,364 KB
testcase_14 AC 314 ms
379,984 KB
testcase_15 AC 593 ms
394,368 KB
testcase_16 AC 327 ms
242,852 KB
testcase_17 AC 252 ms
58,704 KB
testcase_18 AC 253 ms
58,656 KB
testcase_19 AC 546 ms
394,432 KB
testcase_20 AC 700 ms
394,440 KB
testcase_21 AC 564 ms
394,376 KB
testcase_22 AC 69 ms
213,968 KB
testcase_23 AC 68 ms
220,684 KB
testcase_24 AC 6 ms
22,264 KB
testcase_25 AC 5 ms
22,244 KB
testcase_26 AC 3 ms
4,380 KB
testcase_27 AC 4 ms
4,376 KB
testcase_28 AC 2 ms
4,376 KB
testcase_29 AC 2 ms
4,376 KB
testcase_30 AC 66 ms
240,548 KB
testcase_31 AC 2 ms
4,380 KB
testcase_32 AC 117 ms
216,624 KB
testcase_33 AC 7 ms
14,884 KB
testcase_34 AC 7 ms
12,120 KB
testcase_35 AC 246 ms
44,372 KB
testcase_36 AC 387 ms
307,852 KB
testcase_37 AC 825 ms
394,436 KB
testcase_38 AC 252 ms
43,916 KB
testcase_39 AC 21 ms
61,760 KB
testcase_40 AC 15 ms
35,536 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <algorithm>
#include <iostream>
#include <numeric>
#include <string>
#include <tuple>
#include <utility>
#include <vector>

#define rep(i, a, b) for (int i = int(a); i < int(b); i++)
using namespace std;
using ll = long long int;
using P = pair<ll, ll>;

// clang-format off
#ifdef _DEBUG_
#define dump(...) do{ cerr << __LINE__ << ":\t" << #__VA_ARGS__ << " = "; debug_print(__VA_ARGS__); } while(false)
template<typename T, typename... Ts> void debug_print(const T &t, const Ts &...ts) { cerr << t; ((cerr << ", " << ts), ...); cerr << endl; }
#else
#define dump(...) do{ } while(false)
#endif
template<typename T> vector<T> make_v(size_t a, T b) { return vector<T>(a, b); }
template<typename... Ts> auto make_v(size_t a, Ts... ts) { return vector<decltype(make_v(ts...))>(a, make_v(ts...)); }
template<typename T> bool chmin(T &a, const T& b) { if (a > b) {a = b; return true; } return false; }
template<typename T> bool chmax(T &a, const T& b) { if (a < b) {a = b; return true; } return false; }
template<typename T, typename... Ts> void print(const T& t, const Ts&... ts) { cout << t; ((cout << ' ' << ts), ...); cout << '\n'; }
template<typename... Ts> void input(Ts&... ts) { (cin >> ... >> ts); }
template<typename T> istream &operator,(istream &in, T &t) { return in >> t; }
// clang-format on

constexpr int sz = 20010;

bool ng[sz][sz];

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n;
    input(n);
    constexpr int radius = 10;
    int ans = 0;
    rep(i, 0, n) {
        int x, y;
        input(x, y);
        if (!ng[x][y]) {
            ans += !ng[x][y];
            rep(dx, x - 2 * radius, x + 2 * radius + 1) {
                if (dx < 0 || dx >= sz) continue;
                rep(dy, y - 2 * radius, y + 2 * radius + 1) {
                    if (dy < 0 || dy >= sz) continue;
                    ng[dx][dy] |= (dx - x) * (dx - x) + (dy - y) * (dy - y) < 4 * radius * radius;
                }
            }
        }
    }
    print(ans);

    return 0;
}
0