結果

問題 No.202 1円玉投げ
ユーザー agatanagatan
提出日時 2015-05-04 18:29:39
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,413 bytes
コンパイル時間 645 ms
コンパイル使用メモリ 74,676 KB
実行使用メモリ 100,524 KB
最終ジャッジ日時 2023-08-23 22:17:56
合計ジャッジ時間 5,149 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
100,268 KB
testcase_01 AC 85 ms
100,332 KB
testcase_02 AC 39 ms
97,108 KB
testcase_03 WA -
testcase_04 AC 40 ms
97,132 KB
testcase_05 AC 42 ms
97,584 KB
testcase_06 AC 81 ms
99,476 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 65 ms
98,656 KB
testcase_10 AC 50 ms
97,760 KB
testcase_11 AC 61 ms
98,464 KB
testcase_12 AC 61 ms
98,380 KB
testcase_13 AC 51 ms
97,840 KB
testcase_14 AC 43 ms
97,592 KB
testcase_15 AC 64 ms
98,640 KB
testcase_16 AC 67 ms
100,244 KB
testcase_17 AC 69 ms
100,264 KB
testcase_18 AC 69 ms
100,404 KB
testcase_19 AC 62 ms
98,652 KB
testcase_20 AC 75 ms
99,288 KB
testcase_21 AC 63 ms
98,480 KB
testcase_22 AC 40 ms
97,200 KB
testcase_23 AC 40 ms
97,164 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 40 ms
97,316 KB
testcase_27 AC 40 ms
97,132 KB
testcase_28 WA -
testcase_29 WA -
testcase_30 AC 41 ms
97,136 KB
testcase_31 WA -
testcase_32 AC 40 ms
97,164 KB
testcase_33 AC 39 ms
97,128 KB
testcase_34 AC 40 ms
97,128 KB
testcase_35 AC 69 ms
100,292 KB
testcase_36 AC 74 ms
100,524 KB
testcase_37 AC 88 ms
99,900 KB
testcase_38 AC 71 ms
100,240 KB
testcase_39 AC 39 ms
97,284 KB
testcase_40 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <vector>
#include <functional>
#include <algorithm>
#include <cmath>
#include <array>

#define REP(i,n) for(int i=0;i<(n);i++)

using namespace std;

typedef pair<int, int> P;

const int MAX_N = 100000;
array<array<vector<P>, 2000>, 20000 / 10> fields;

bool is_on(pair<int,int> &a, pair<int, int> &b)
{
    double dist = (a.first - b.first) * (a.first - b.first) + (a.second - b.second) * (a.second - b.second);
    dist = sqrt(dist);
    return dist < 20;
}

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

    int N;
    cin >> N;
    int x, y;
    cin >> x >> y;
    N--;
    vector<pair<int, int> > coins;
    coins.emplace_back(x, y);

    int ans = 1;

    REP(k, N) {
        cin >> x >> y;
        P current(x, y);
        int fx = x / 20, fy = y / 20;
        bool flg = true;
        for (int i = -1; i <= 1 && flg; ++i) {
            for (int j = -1; j <= 1 && flg; ++j) {
                if (fx + i < 0 || fx + i >= 2000 || fy + j < 0 || fy + j >= 2000) continue;
                for (auto p: fields[fx + i][fy + j]) {
                    if (is_on(p, current)) {
                        flg = false;
                        break;
                    }
                }
            }
        }
        if (flg) {
            fields[fx][fy].push_back(current);
            ans++;
        }
    }
    cout << ans << endl;

    return 0;
}
0