結果

問題 No.202 1円玉投げ
ユーザー AreTrashAreTrash
提出日時 2016-05-26 08:18:18
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 2,159 ms / 5,000 ms
コード長 1,992 bytes
コンパイル時間 3,734 ms
コンパイル使用メモリ 105,592 KB
実行使用メモリ 325,128 KB
最終ジャッジ日時 2023-08-23 23:22:10
合計ジャッジ時間 35,804 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,434 ms
30,780 KB
testcase_01 AC 2,159 ms
325,128 KB
testcase_02 AC 59 ms
20,292 KB
testcase_03 AC 58 ms
24,408 KB
testcase_04 AC 59 ms
22,448 KB
testcase_05 AC 180 ms
47,124 KB
testcase_06 AC 1,704 ms
233,336 KB
testcase_07 AC 1,890 ms
246,632 KB
testcase_08 AC 1,909 ms
249,400 KB
testcase_09 AC 1,087 ms
177,824 KB
testcase_10 AC 489 ms
102,180 KB
testcase_11 AC 897 ms
155,768 KB
testcase_12 AC 917 ms
159,768 KB
testcase_13 AC 532 ms
109,268 KB
testcase_14 AC 197 ms
48,936 KB
testcase_15 AC 1,035 ms
174,468 KB
testcase_16 AC 1,430 ms
33,140 KB
testcase_17 AC 1,407 ms
29,280 KB
testcase_18 AC 1,406 ms
31,316 KB
testcase_19 AC 990 ms
169,540 KB
testcase_20 AC 1,515 ms
218,812 KB
testcase_21 AC 976 ms
168,972 KB
testcase_22 AC 70 ms
24,444 KB
testcase_23 AC 71 ms
24,396 KB
testcase_24 AC 70 ms
22,372 KB
testcase_25 AC 71 ms
24,420 KB
testcase_26 AC 80 ms
28,384 KB
testcase_27 AC 80 ms
28,384 KB
testcase_28 AC 71 ms
22,780 KB
testcase_29 AC 72 ms
24,524 KB
testcase_30 AC 81 ms
26,340 KB
testcase_31 AC 72 ms
22,444 KB
testcase_32 AC 82 ms
28,416 KB
testcase_33 AC 75 ms
25,712 KB
testcase_34 AC 73 ms
24,596 KB
testcase_35 AC 1,413 ms
36,500 KB
testcase_36 AC 1,405 ms
26,604 KB
testcase_37 AC 2,043 ms
255,204 KB
testcase_38 AC 1,408 ms
32,560 KB
testcase_39 AC 62 ms
22,628 KB
testcase_40 AC 63 ms
24,396 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;

namespace No202_1{
    public class Program{
        public static void Main(string[] args){
            var sr = new StreamReader();
            //---------------------------------
            const int H = 20000;
            const int W = 20000;
            var map = new bool[H + 1, W + 1];
            var sum = 0;
            var N = sr.Next<int>();

            Func<int, int, bool> isInside = (x, y) => 0 <= x && x <= W && 0 <= y && y <= H;

            for(var i = 0; i < N; i++){
                var nx = sr.Next<int>();
                var ny = sr.Next<int>();

                var isExist = false;
                for(var y = -20; y <= 20; y++){
                    for(var x = -20; x <= 20; x++){
                        isExist |= isInside(ny + y, nx + x) && map[ny + y, nx + x] && x * x + y * y < 400;
                    }
                }

                if(!isExist){
                    sum++;
                    map[ny, nx] = true;
                }
            }

            Console.WriteLine(sum);
            //---------------------------------
        }
    }

    public class StreamReader{
        private readonly char[] _c = {' '};
        private int _index = -1;
        private string[] _input = new string[0];

        public T Next<T>(){
            if(_index == _input.Length - 1){
                _index = -1;
                while(true){
                    string rl = Console.ReadLine();
                    if(rl == null){
                        if(typeof(T).IsClass) return default(T);
                        return (T)typeof(T).GetField("MinValue").GetValue(null);
                    }
                    if(rl != ""){
                        _input = rl.Split(_c, StringSplitOptions.RemoveEmptyEntries);
                        break;
                    }
                }
            }
            return (T)Convert.ChangeType(_input[++_index], typeof(T), System.Globalization.CultureInfo.InvariantCulture);
        }
    }
}
0