結果

問題 No.202 1円玉投げ
ユーザー xuzijian629xuzijian629
提出日時 2018-11-05 22:11:31
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 90 ms / 5,000 ms
コード長 1,187 bytes
コンパイル時間 2,181 ms
コンパイル使用メモリ 203,448 KB
実行使用メモリ 30,292 KB
最終ジャッジ日時 2023-08-23 23:56:15
合計ジャッジ時間 5,695 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 82 ms
29,952 KB
testcase_01 AC 89 ms
30,076 KB
testcase_02 AC 13 ms
27,072 KB
testcase_03 AC 14 ms
26,916 KB
testcase_04 AC 13 ms
26,844 KB
testcase_05 AC 18 ms
27,144 KB
testcase_06 AC 78 ms
29,324 KB
testcase_07 AC 85 ms
29,352 KB
testcase_08 AC 87 ms
29,372 KB
testcase_09 AC 54 ms
28,392 KB
testcase_10 AC 31 ms
27,492 KB
testcase_11 AC 46 ms
28,420 KB
testcase_12 AC 49 ms
28,196 KB
testcase_13 AC 33 ms
27,568 KB
testcase_14 AC 19 ms
27,328 KB
testcase_15 AC 52 ms
28,416 KB
testcase_16 AC 70 ms
30,292 KB
testcase_17 AC 75 ms
29,968 KB
testcase_18 AC 75 ms
30,180 KB
testcase_19 AC 50 ms
28,264 KB
testcase_20 AC 71 ms
28,996 KB
testcase_21 AC 49 ms
28,320 KB
testcase_22 AC 14 ms
27,200 KB
testcase_23 AC 15 ms
26,852 KB
testcase_24 AC 15 ms
26,828 KB
testcase_25 AC 15 ms
26,824 KB
testcase_26 AC 15 ms
26,984 KB
testcase_27 AC 14 ms
27,080 KB
testcase_28 AC 15 ms
26,852 KB
testcase_29 AC 14 ms
26,896 KB
testcase_30 AC 15 ms
26,840 KB
testcase_31 AC 14 ms
26,900 KB
testcase_32 AC 15 ms
26,948 KB
testcase_33 AC 14 ms
26,904 KB
testcase_34 AC 15 ms
26,864 KB
testcase_35 AC 74 ms
29,940 KB
testcase_36 AC 80 ms
30,024 KB
testcase_37 AC 90 ms
29,520 KB
testcase_38 AC 79 ms
30,016 KB
testcase_39 AC 14 ms
26,848 KB
testcase_40 AC 14 ms
26,892 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using i64 = int64_t;
using vi = vector<i64>;
using vvi = vector<vi>;

using ii = pair<int, int>;
const int nax = 1001;
vector<ii> b[nax][nax];

bool valid(int i, int j) {
    return 0 <= i && i < nax && 0 <= j && j < nax;
}

int dist2(int x, int y, int xx, int yy) {
    return (x - xx) * (x - xx) + (y - yy) * (y - yy);
}

int main() {
    int n;
    cin >> n;
    for (int i = 0; i < n; i++) {
        int x, y;
        cin >> x >> y;
        int xx = x / 20;
        int yy = y / 20;
        int ok = 1;
        for (int dx = -1; dx <= 1; dx++) {
            for (int dy = -1; dy <= 1; dy++) {
                if (valid(xx + dx, yy + dy)) {
                    for (ii k: b[xx + dx][yy + dy]) {
                        if (dist2(k.first, k.second, x, y) < 400) {
                            ok = 0;
                        }
                    }
                }
            }
        }
        if (ok) {
            b[xx][yy].push_back(ii(x, y));
        }
    }

    int cnt = 0;
    for (int i = 0; i < nax; i++) {
        for (int j = 0; j < nax; j++) {
            cnt += b[i][j].size();
        }
    }
    cout << cnt << endl;
}
0