結果

問題 No.202 1円玉投げ
ユーザー finefine
提出日時 2020-05-22 02:41:39
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 202 ms / 5,000 ms
コード長 1,089 bytes
コンパイル時間 1,602 ms
コンパイル使用メモリ 174,356 KB
実行使用メモリ 7,248 KB
最終ジャッジ日時 2023-08-24 00:13:00
合計ジャッジ時間 5,558 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 62 ms
5,344 KB
testcase_01 AC 121 ms
7,212 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 6 ms
4,384 KB
testcase_06 AC 155 ms
6,796 KB
testcase_07 AC 183 ms
6,932 KB
testcase_08 AC 186 ms
7,248 KB
testcase_09 AC 84 ms
6,028 KB
testcase_10 AC 24 ms
4,952 KB
testcase_11 AC 64 ms
5,612 KB
testcase_12 AC 67 ms
5,600 KB
testcase_13 AC 28 ms
4,932 KB
testcase_14 AC 6 ms
4,376 KB
testcase_15 AC 80 ms
6,004 KB
testcase_16 AC 35 ms
5,348 KB
testcase_17 AC 153 ms
5,528 KB
testcase_18 AC 152 ms
5,364 KB
testcase_19 AC 73 ms
5,600 KB
testcase_20 AC 138 ms
6,460 KB
testcase_21 AC 73 ms
5,724 KB
testcase_22 AC 2 ms
4,376 KB
testcase_23 AC 3 ms
4,376 KB
testcase_24 AC 2 ms
4,380 KB
testcase_25 AC 1 ms
4,380 KB
testcase_26 AC 2 ms
4,376 KB
testcase_27 AC 2 ms
4,376 KB
testcase_28 AC 2 ms
4,376 KB
testcase_29 AC 1 ms
4,376 KB
testcase_30 AC 2 ms
4,380 KB
testcase_31 AC 2 ms
4,376 KB
testcase_32 AC 2 ms
4,380 KB
testcase_33 AC 2 ms
4,376 KB
testcase_34 AC 1 ms
4,380 KB
testcase_35 AC 134 ms
5,440 KB
testcase_36 AC 45 ms
5,320 KB
testcase_37 AC 202 ms
6,988 KB
testcase_38 AC 135 ms
5,296 KB
testcase_39 AC 2 ms
4,380 KB
testcase_40 AC 2 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

using ll = long long;

constexpr char newl = '\n';

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);

    int n;
    cin >> n;

    vector<ll> x(n), y(n);
    map<ll, vector<int> > memo;
    int ans = 0;
    for (int i = 0; i < n; i++) {
        cin >> x[i] >> y[i];
        auto it = memo.upper_bound(x[i] - 20);

        bool f = true;
        while (it != memo.end()) {
            if (it->first >= x[i] + 20) break;

            auto& v = it->second;
            int jj = 0;
            while (jj < v.size()) {
                int j = v[jj];

                ll dx = x[i] - x[j];
                ll dy = y[i] - y[j];
                ll r2 = dx * dx + dy * dy;
                if (r2 >= 400) {
                    ++jj;
                    continue;
                }

                f = false;
                break;
            }
            if (!f) break;
            ++it;
        }

        if (f) {
            ++ans;
            memo[x[i]].push_back(i);
        }
    }

    cout << ans << newl;
    return 0;
}
0