結果

問題 No.33 アメーバがたくさん
ユーザー nanophoto12nanophoto12
提出日時 2014-11-02 05:13:28
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 1,263 bytes
コンパイル時間 2,124 ms
コンパイル使用メモリ 108,828 KB
実行使用メモリ 24,112 KB
最終ジャッジ日時 2023-10-24 17:41:42
合計ジャッジ時間 2,915 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 22 ms
24,112 KB
testcase_01 AC 24 ms
24,112 KB
testcase_02 AC 22 ms
24,112 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 23 ms
24,112 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;

class Program
{
    public static void Main(string[] args)
    {
        var firstline = Console.ReadLine().Split(' ');
        var n = long.Parse(firstline[0]);
        var d = long.Parse(firstline[1]);
        var t = long.Parse(firstline[2]);
        var secondline = Console.ReadLine().Split(' ');
        var points = new long[n];
        var counted = new bool[n];
        for (long i = 0; i < n; i++)
        {
            points[i] = long.Parse(secondline[i]);
        }
        long count = 0;
        for (long i = 0; i < n; i++)
        {
            if (counted[i])
            {
                continue;
            }
            counted[i] = true;
            count += 2*t + 1;
            for (long k = i + 1; k < n; k++)
            {
                if ((points[k] - points[i])%d != 0)
                {
                    continue;
                }
                var distance = Math.Abs(points[k] - points[i]) / d;
                if (distance > 2 * t)
                {
                    continue;
                }
                counted[k] = true;
                count += distance + Math.Max(0, distance - t);
            }
        }
        Console.WriteLine(count);
    }
}
0