結果

問題 No.202 1円玉投げ
ユーザー 14番14番
提出日時 2016-05-03 13:54:13
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 2,223 ms / 5,000 ms
コード長 2,816 bytes
コンパイル時間 2,126 ms
コンパイル使用メモリ 106,108 KB
実行使用メモリ 437,368 KB
最終ジャッジ日時 2023-08-23 23:21:16
合計ジャッジ時間 44,323 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,362 ms
63,636 KB
testcase_01 AC 2,223 ms
437,368 KB
testcase_02 AC 87 ms
24,880 KB
testcase_03 AC 59 ms
26,284 KB
testcase_04 AC 58 ms
26,200 KB
testcase_05 AC 721 ms
62,612 KB
testcase_06 AC 1,956 ms
327,640 KB
testcase_07 AC 2,114 ms
356,656 KB
testcase_08 AC 2,075 ms
358,892 KB
testcase_09 AC 1,441 ms
232,668 KB
testcase_10 AC 1,004 ms
127,268 KB
testcase_11 AC 1,301 ms
201,780 KB
testcase_12 AC 1,312 ms
205,852 KB
testcase_13 AC 1,009 ms
137,928 KB
testcase_14 AC 730 ms
68,652 KB
testcase_15 AC 1,426 ms
225,924 KB
testcase_16 AC 1,261 ms
68,000 KB
testcase_17 AC 1,382 ms
91,904 KB
testcase_18 AC 1,380 ms
91,896 KB
testcase_19 AC 1,374 ms
216,372 KB
testcase_20 AC 1,807 ms
302,864 KB
testcase_21 AC 1,387 ms
216,820 KB
testcase_22 AC 629 ms
44,980 KB
testcase_23 AC 632 ms
42,852 KB
testcase_24 AC 65 ms
26,456 KB
testcase_25 AC 65 ms
26,396 KB
testcase_26 AC 619 ms
41,888 KB
testcase_27 AC 621 ms
40,044 KB
testcase_28 AC 66 ms
26,308 KB
testcase_29 AC 65 ms
26,472 KB
testcase_30 AC 637 ms
44,888 KB
testcase_31 AC 66 ms
26,244 KB
testcase_32 AC 635 ms
44,768 KB
testcase_33 AC 73 ms
25,720 KB
testcase_34 AC 626 ms
42,584 KB
testcase_35 AC 1,302 ms
64,028 KB
testcase_36 AC 1,385 ms
67,256 KB
testcase_37 AC 2,076 ms
376,876 KB
testcase_38 AC 1,300 ms
62,088 KB
testcase_39 AC 69 ms
27,252 KB
testcase_40 AC 65 ms
26,592 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;
using System.Collections.Generic;
using System.Text;
using System.Linq;
 
class Program
{
    public void Proc()
    {
        Reader.IsDebug = false;
        int coinCount = int.Parse(Reader.ReadLine());
        List<Ichien> coinList = new List<Ichien>();
        Ichien[,] map = new Ichien[20001, 20001];
        for(int i=0; i<coinCount; i++) {
            Ichien newCoin = new Ichien(Reader.GetInt());
            bool isKasanari = false;
            
            int xMin = (int)Math.Max(newCoin.X - 20, 0);
            int xMax = (int)Math.Min(newCoin.X + 20, 20000);
            int yMin = (int)Math.Max(newCoin.Y - 20, 0);
            int yMax = (int)Math.Min(newCoin.Y + 20, 20000);
            
            for(int j=xMin; j<=xMax; j++) {
                for(int k=yMin; k<=yMax; k++) {
                    if(map[j,k] != null && map[j,k].IsKasanaru(newCoin)) {
                        isKasanari = true;
                    }
                }
            }
            
            if(!isKasanari) {
                coinList.Add(newCoin);
                map[newCoin.X, newCoin.Y] = newCoin;
            }
        }
        Console.WriteLine(coinList.Count);


    }
    
    public class Ichien {
        public long X;
        public long Y;
        public int R = 10;
        
        public Ichien(int[] pos) {
            this.X = pos[0];
            this.Y = pos[1];
        }
        public bool IsKasanaru(Ichien target) {
            long range = ((this.X - target.X) * (this.X - target.X)) + ((this.Y - target.Y) * (this.Y - target.Y));
            return (this.R + target.R) * (this.R + target.R) > range;
        }
    }


    public class Reader
    {
        public static bool IsDebug = true;
        private static String PlainInput = @"


3
0 0
15 0
30 0


 
";
        private static System.IO.StringReader Sr = null;
        public static string ReadLine()
        {
            if (IsDebug)
            {
                if (Sr == null)
                {
                    Sr = new System.IO.StringReader(PlainInput.Trim());
                }
                return Sr.ReadLine();
            }
            else
            {
                return Console.ReadLine();
            }
        }
        public static int[] GetInt(char delimiter = ' ', bool trim = false)
        {
            string inptStr = ReadLine();
            if (trim)
            {
                inptStr = inptStr.Trim();
            }
            string[] inpt = inptStr.Split(delimiter);
            int[] ret = new int[inpt.Length];
            for (int i = 0; i < inpt.Length; i++)
            {
                ret[i] = int.Parse(inpt[i]);
            }
            return ret;
        }
    }
    static void Main()
    {
        Program prg = new Program();
        prg.Proc();
    }
}
0