結果

問題 No.202 1円玉投げ
ユーザー mban
提出日時 2017-07-11 19:31:00
言語 C#(csc)
(csc 3.9.0)
結果
MLE  
(最新)
AC  
(最初)
実行時間 -
コード長 1,691 bytes
コンパイル時間 3,343 ms
コンパイル使用メモリ 110,256 KB
実行使用メモリ 604,720 KB
最終ジャッジ日時 2025-02-24 04:02:41
合計ジャッジ時間 29,228 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 22 MLE * 16
権限があれば一括ダウンロードができます
コンパイルメッセージ
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;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Text;
using System.Text.RegularExpressions;
using System.Linq;
using System.IO;

class Program
{
    static void Main()
    {
        new Magatro().Solve();
    }
}

class Magatro
{

    private int N;
    private int[] X, Y;

    bool[,] B = new bool[40050, 40050];
    private int[] Lx, Ly;

    private void Scan()
    {
        N = int.Parse(Console.ReadLine());
        X = new int[N];
        Y = new int[N];
        for (int i = 0; i < N; i++)
        {
            var line = Console.ReadLine().Split(' ');
            X[i] = int.Parse(line[0]) + 20020;
            Y[i] = int.Parse(line[1]) + 20020;
        }
    }

    private void CalcL()
    {
        var resultX = new List<int>();
        var resultY = new List<int>();
        for (int x = -20; x <= 20; x++)
        {
            for (int y = -20; y <= 20; y++)
            {
                if (Math.Sqrt(x * x + y * y) < 20)
                {
                    resultX.Add(x);
                    resultY.Add(y);
                }
            }
        }
        Lx = resultX.ToArray();
        Ly = resultY.ToArray();
    }

    private bool C(int n)
    {
        if (B[X[n], Y[n]]) return false;

        for (int i = 0; i < Lx.Length; i++)
        {
            B[X[n] + Lx[i], Y[n] + Ly[i]] = true;
        }
        return true;
    }

    public void Solve()
    {
        Scan();
        CalcL();
        int ans = 0;
        for (int i = 0; i < N; i++)
        {
            if (C(i))
            {
                ans++;
            }
        }
        Console.WriteLine(ans);
    }
}
0