結果

問題 No.202 1円玉投げ
ユーザー finefine
提出日時 2020-05-22 02:29:50
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,110 bytes
コンパイル時間 1,702 ms
コンパイル使用メモリ 175,640 KB
実行使用メモリ 5,572 KB
最終ジャッジ日時 2023-08-24 00:12:54
合計ジャッジ時間 5,691 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 109 ms
5,356 KB
testcase_01 AC 79 ms
5,340 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 4 ms
4,376 KB
testcase_15 WA -
testcase_16 AC 57 ms
5,504 KB
testcase_17 AC 365 ms
5,480 KB
testcase_18 AC 367 ms
5,420 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 2 ms
4,376 KB
testcase_23 AC 2 ms
4,376 KB
testcase_24 AC 2 ms
4,376 KB
testcase_25 WA -
testcase_26 AC 5 ms
4,380 KB
testcase_27 AC 4 ms
4,380 KB
testcase_28 WA -
testcase_29 WA -
testcase_30 AC 2 ms
4,376 KB
testcase_31 AC 2 ms
4,380 KB
testcase_32 AC 2 ms
4,376 KB
testcase_33 WA -
testcase_34 AC 2 ms
4,376 KB
testcase_35 AC 335 ms
5,572 KB
testcase_36 AC 54 ms
5,348 KB
testcase_37 WA -
testcase_38 AC 336 ms
5,356 KB
testcase_39 AC 2 ms
4,376 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);
    for (int i = 0; i < n; i++) {
        cin >> x[i] >> y[i];
    }

    vector<int> ids(n);
    iota(ids.begin(), ids.end(), 0);
    sort(ids.begin(), ids.end(), [&](int i1, int i2){
        return x[i1] < x[i2];
    });

    deque<int> dq;
    for (int i : ids) {
        for (int jj = 0; ;) {
            if (jj >= dq.size()) {
                dq.push_front(i);
                break;
            }
            int& j = dq[jj];

            ll dx = x[i] - x[j];
            if (abs(dx) >= 20) {
                dq.push_front(i);
                break;
            }

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

            if (i > j) break;

            swap(j, dq.back());
            dq.pop_back();
        }
    }
    cout << dq.size() << newl;

    return 0;
}
0