結果

問題 No.202 1円玉投げ
ユーザー tottoripapertottoripaper
提出日時 2015-05-03 23:45:02
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 992 ms / 5,000 ms
コード長 1,084 bytes
コンパイル時間 509 ms
コンパイル使用メモリ 50,936 KB
実行使用メモリ 52,380 KB
最終ジャッジ日時 2023-08-23 21:38:50
合計ジャッジ時間 16,068 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 575 ms
52,328 KB
testcase_01 AC 992 ms
52,308 KB
testcase_02 AC 39 ms
52,340 KB
testcase_03 AC 39 ms
52,260 KB
testcase_04 AC 38 ms
52,376 KB
testcase_05 AC 95 ms
52,332 KB
testcase_06 AC 766 ms
52,312 KB
testcase_07 AC 846 ms
52,288 KB
testcase_08 AC 858 ms
52,380 KB
testcase_09 AC 505 ms
52,344 KB
testcase_10 AC 240 ms
52,344 KB
testcase_11 AC 425 ms
52,340 KB
testcase_12 AC 432 ms
52,340 KB
testcase_13 AC 260 ms
52,340 KB
testcase_14 AC 103 ms
52,324 KB
testcase_15 AC 481 ms
52,348 KB
testcase_16 AC 558 ms
52,332 KB
testcase_17 AC 534 ms
52,328 KB
testcase_18 AC 529 ms
52,304 KB
testcase_19 AC 472 ms
52,292 KB
testcase_20 AC 711 ms
52,332 KB
testcase_21 AC 473 ms
52,296 KB
testcase_22 AC 42 ms
52,340 KB
testcase_23 AC 42 ms
52,312 KB
testcase_24 AC 42 ms
52,296 KB
testcase_25 AC 41 ms
52,308 KB
testcase_26 AC 44 ms
52,352 KB
testcase_27 AC 43 ms
52,324 KB
testcase_28 AC 40 ms
52,344 KB
testcase_29 AC 41 ms
52,332 KB
testcase_30 AC 45 ms
52,292 KB
testcase_31 AC 41 ms
52,336 KB
testcase_32 AC 48 ms
52,336 KB
testcase_33 AC 41 ms
52,300 KB
testcase_34 AC 43 ms
52,340 KB
testcase_35 AC 525 ms
52,332 KB
testcase_36 AC 534 ms
52,312 KB
testcase_37 AC 911 ms
52,300 KB
testcase_38 AC 527 ms
52,308 KB
testcase_39 AC 40 ms
52,336 KB
testcase_40 AC 39 ms
52,328 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

// YukiCoderなら通る

#include <algorithm>
#include <cstdio>
#include <vector>

int N;
std::vector<std::vector<bool>> hasCircle;

int distance(int x1, int y1, int x2, int y2){
    int dx = x1-x2, dy = y1-y2;
    return dx * dx + dy * dy;
}

int main(){
    hasCircle.resize(20001);
    for(int i=0;i<=20000;i++){
        hasCircle[i].resize(20001);
    }
    
    scanf("%d", &N);

    int n = 0;
    for(int i=0;i<N;i++){
        int x, y;
        scanf("%d %d", &x, &y);

        bool flag = false;
        for(int j=-20;j<=20;j++){
            for(int k=-20;k<=20;k++){
                int x2 = x + k, y2 = y + j;
                if(x2 < 0 || x2 > 20000 || y2 < 0 || y2 > 20000){
                    continue;
                }
                if(!hasCircle[y2][x2]){continue;}
                if(distance(x, y, x2, y2) < 400){
                    flag = true;
                    break;
                }
            }
            if(flag){break;}
        }

        if(!flag){
            hasCircle[y][x] = true;
            n += 1;
        }
    }

    printf("%d\n", n);
}
0