結果

問題 No.202 1円玉投げ
ユーザー maine_honzukimaine_honzuki
提出日時 2020-12-22 00:49:03
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 82 ms / 5,000 ms
コード長 984 bytes
コンパイル時間 2,890 ms
コンパイル使用メモリ 202,728 KB
実行使用メモリ 12,376 KB
最終ジャッジ日時 2023-08-24 00:17:14
合計ジャッジ時間 5,114 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 67 ms
10,692 KB
testcase_01 AC 78 ms
12,376 KB
testcase_02 AC 5 ms
9,736 KB
testcase_03 AC 6 ms
9,752 KB
testcase_04 AC 5 ms
9,660 KB
testcase_05 AC 9 ms
9,624 KB
testcase_06 AC 66 ms
11,860 KB
testcase_07 AC 75 ms
11,772 KB
testcase_08 AC 76 ms
11,916 KB
testcase_09 AC 43 ms
11,184 KB
testcase_10 AC 21 ms
10,100 KB
testcase_11 AC 37 ms
10,664 KB
testcase_12 AC 37 ms
10,728 KB
testcase_13 AC 22 ms
10,208 KB
testcase_14 AC 11 ms
9,724 KB
testcase_15 AC 43 ms
10,832 KB
testcase_16 AC 61 ms
10,772 KB
testcase_17 AC 61 ms
10,828 KB
testcase_18 AC 61 ms
10,828 KB
testcase_19 AC 39 ms
11,056 KB
testcase_20 AC 61 ms
11,404 KB
testcase_21 AC 39 ms
10,756 KB
testcase_22 AC 6 ms
9,532 KB
testcase_23 AC 6 ms
9,480 KB
testcase_24 AC 6 ms
9,752 KB
testcase_25 AC 6 ms
9,452 KB
testcase_26 AC 6 ms
9,592 KB
testcase_27 AC 6 ms
9,464 KB
testcase_28 AC 6 ms
9,456 KB
testcase_29 AC 6 ms
9,472 KB
testcase_30 AC 6 ms
9,460 KB
testcase_31 AC 6 ms
9,464 KB
testcase_32 AC 6 ms
9,480 KB
testcase_33 AC 6 ms
9,460 KB
testcase_34 AC 7 ms
9,524 KB
testcase_35 AC 61 ms
10,684 KB
testcase_36 AC 66 ms
10,624 KB
testcase_37 AC 82 ms
12,196 KB
testcase_38 AC 65 ms
10,640 KB
testcase_39 AC 5 ms
9,516 KB
testcase_40 AC 6 ms
9,456 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

vector<pair<int, int>> mesh[510][510];

int main() {
    auto overlap = [](pair<int, int> P, pair<int, int> Q) {
        int dx = P.first - Q.first, dy = P.second - Q.second;
        return dx * dx + dy * dy < 400;
    };
    auto out = [&](pair<int, int> P) {
        int i = P.first / 40, j = P.second / 40;
        bool flag = false;
        for (int k = max(0, i - 1); k <= i + 1; k++) {
            for (int l = max(0, j - 1); l <= j + 1; l++) {
                for (auto& Q : mesh[k][l]) {
                    flag |= overlap(P, Q);
                }
            }
        }
        return flag;
    };

    int N, ans = 0;
    cin >> N;
    while (N--) {
        pair<int, int> P;
        cin >> P.first >> P.second;
        if (out(P))
            continue;
        else {
            int i = P.first / 40, j = P.second / 40;
            mesh[i][j].emplace_back(P);
            ans++;
        }
    }

    cout << ans << endl;
}
0