結果

問題 No.202 1円玉投げ
ユーザー koyoprokoyopro
提出日時 2015-10-11 13:08:49
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 94 ms / 5,000 ms
コード長 1,049 bytes
コンパイル時間 1,637 ms
コンパイル使用メモリ 149,512 KB
実行使用メモリ 36,104 KB
最終ジャッジ日時 2023-08-23 23:12:18
合計ジャッジ時間 5,160 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 82 ms
35,960 KB
testcase_01 AC 94 ms
35,848 KB
testcase_02 AC 13 ms
32,356 KB
testcase_03 AC 13 ms
32,364 KB
testcase_04 AC 13 ms
32,264 KB
testcase_05 AC 17 ms
32,504 KB
testcase_06 AC 82 ms
35,124 KB
testcase_07 AC 91 ms
35,260 KB
testcase_08 AC 89 ms
35,536 KB
testcase_09 AC 52 ms
33,852 KB
testcase_10 AC 29 ms
32,952 KB
testcase_11 AC 47 ms
33,540 KB
testcase_12 AC 48 ms
33,576 KB
testcase_13 AC 31 ms
33,080 KB
testcase_14 AC 18 ms
32,576 KB
testcase_15 AC 52 ms
33,992 KB
testcase_16 AC 73 ms
35,964 KB
testcase_17 AC 73 ms
35,952 KB
testcase_18 AC 74 ms
35,900 KB
testcase_19 AC 50 ms
33,668 KB
testcase_20 AC 74 ms
35,048 KB
testcase_21 AC 51 ms
33,728 KB
testcase_22 AC 14 ms
32,412 KB
testcase_23 AC 14 ms
32,328 KB
testcase_24 AC 13 ms
32,376 KB
testcase_25 AC 13 ms
32,288 KB
testcase_26 AC 13 ms
32,620 KB
testcase_27 AC 13 ms
32,320 KB
testcase_28 AC 14 ms
32,284 KB
testcase_29 AC 14 ms
32,380 KB
testcase_30 AC 14 ms
32,324 KB
testcase_31 AC 13 ms
32,488 KB
testcase_32 AC 14 ms
32,320 KB
testcase_33 AC 13 ms
32,360 KB
testcase_34 AC 14 ms
32,324 KB
testcase_35 AC 73 ms
36,084 KB
testcase_36 AC 82 ms
35,972 KB
testcase_37 AC 94 ms
35,656 KB
testcase_38 AC 78 ms
36,104 KB
testcase_39 AC 13 ms
32,352 KB
testcase_40 AC 13 ms
32,300 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

#define REP(i, n) for(int i=0; i<(n); i++)
struct P { int x, y; P(){}; P(int _x, int _y): x(_x), y(_y){}; };

int N,T;
vector<int> M[1111][1111];
vector<P> ps;
int distance2(P a, P b) {
    return pow(a.x - b.x, 2) + pow(a.y - b.y, 2);
}
signed main()
{
    cin >> N;
    int ans = 0;
    int x,y;
    REP(i,N) {
        cin >> x >> y;
        ps.push_back(P(x, y));
        int mx = ps[i].x / 20;
        int my = ps[i].y / 20;
        int dxy9[] = {-1, 0, 1};
        bool ok = true;
        REP(k,9) {
            int nx = mx + dxy9[k/3];
            int ny = my + dxy9[k%3];
            if (nx<0||ny<0) continue;
            for (auto&& j : M[nx][ny]) {
                if (distance2(ps[j], ps[i]) < 400) {
                    // conflict
                    ok = false;
                    break;
                }
            }
            if (!ok) break;
        }
        if (ok) {
            M[mx][my].push_back(i);
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}
0