結果

問題 No.202 1円玉投げ
ユーザー kakira9618kakira9618
提出日時 2015-05-04 00:50:24
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 79 ms / 5,000 ms
コード長 1,615 bytes
コンパイル時間 764 ms
コンパイル使用メモリ 91,132 KB
実行使用メモリ 6,496 KB
最終ジャッジ日時 2023-08-23 22:06:02
合計ジャッジ時間 3,789 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 79 ms
6,032 KB
testcase_01 AC 73 ms
6,424 KB
testcase_02 AC 2 ms
4,492 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 6 ms
4,552 KB
testcase_06 AC 63 ms
5,868 KB
testcase_07 AC 73 ms
6,148 KB
testcase_08 AC 72 ms
5,968 KB
testcase_09 AC 40 ms
5,400 KB
testcase_10 AC 17 ms
5,044 KB
testcase_11 AC 33 ms
5,328 KB
testcase_12 AC 34 ms
5,344 KB
testcase_13 AC 19 ms
4,980 KB
testcase_14 AC 8 ms
4,512 KB
testcase_15 AC 39 ms
5,316 KB
testcase_16 AC 66 ms
6,320 KB
testcase_17 AC 67 ms
6,468 KB
testcase_18 AC 66 ms
6,152 KB
testcase_19 AC 36 ms
5,336 KB
testcase_20 AC 57 ms
5,756 KB
testcase_21 AC 35 ms
5,464 KB
testcase_22 AC 3 ms
4,376 KB
testcase_23 AC 3 ms
4,508 KB
testcase_24 AC 3 ms
4,376 KB
testcase_25 AC 3 ms
4,376 KB
testcase_26 AC 3 ms
4,376 KB
testcase_27 AC 3 ms
4,432 KB
testcase_28 AC 3 ms
4,380 KB
testcase_29 AC 3 ms
4,380 KB
testcase_30 AC 3 ms
4,504 KB
testcase_31 AC 3 ms
4,592 KB
testcase_32 AC 3 ms
4,464 KB
testcase_33 AC 3 ms
4,420 KB
testcase_34 AC 3 ms
4,380 KB
testcase_35 AC 69 ms
5,944 KB
testcase_36 AC 73 ms
5,996 KB
testcase_37 AC 76 ms
6,496 KB
testcase_38 AC 74 ms
5,992 KB
testcase_39 AC 2 ms
4,500 KB
testcase_40 AC 2 ms
4,484 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <cctype>
#include <climits>
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <list>
#include <queue>
#include <deque>
#include <algorithm>
#include <numeric>
#include <utility>
#include <complex>
#include <memory>
#include <functional>
 
using namespace std;

struct coin{
    int id;
    int x;
    int y;
};

bool check(coin &a, coin &b) {

    int dx = a.x - b.x;
    int dy = a.y - b.y;
    return (dx * dx + dy * dy) < 400;
}

bool dame(int x, int y) {
    return x < 0 || x >= 201 || y < 0 || y >= 201;
}

int main(int argc, char const *argv[]) {
    int N;
    cin >> N;
    vector<coin> coins[201][201];
    std::vector<int> flag(N, 0);
    for (int i = 0; i < N; i++) {
        int x, y;
        cin >> x >> y;
        int px = x / 100;
        int py = y / 100;
        coin tgt = (coin){i, x, y};

        bool flag = false;
        for (int i = -1 ; i <= 1; i++) {
            for (int j = -1 ; j <= 1; j++) {
                if (dame(px + i, py + j)) continue;
                for (int k = 0; k < coins[px + i][py + j].size(); k++) {
                    if (check(coins[px + i][py + j][k], tgt)) {
                        flag = true;
                    }
                }
            }
        }
        if (!flag) {
            coins[px][py].push_back(tgt);
        }
    }
    int ans = 0;
    for (int i = 0; i < 201; i++) {
        for (int j = 0; j < 201; j++) {
            ans += coins[i][j].size();
        }
    }
    cout << ans << endl;

    
    return 0;
}
0