結果

問題 No.475 最終日 - Writerの怠慢
ユーザー Tomohiko HasegawaTomohiko Hasegawa
提出日時 2019-04-19 16:47:56
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 107 ms / 2,000 ms
コード長 2,272 bytes
コンパイル時間 1,956 ms
コンパイル使用メモリ 111,860 KB
実行使用メモリ 35,212 KB
最終ジャッジ日時 2023-10-23 17:40:49
合計ジャッジ時間 4,329 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 33 ms
26,168 KB
testcase_01 AC 34 ms
26,168 KB
testcase_02 AC 38 ms
26,484 KB
testcase_03 AC 43 ms
27,252 KB
testcase_04 AC 104 ms
35,212 KB
testcase_05 AC 104 ms
35,212 KB
testcase_06 AC 105 ms
35,212 KB
testcase_07 AC 106 ms
35,212 KB
testcase_08 AC 105 ms
35,212 KB
testcase_09 AC 104 ms
35,212 KB
testcase_10 AC 106 ms
35,212 KB
testcase_11 AC 107 ms
35,212 KB
testcase_12 AC 85 ms
34,360 KB
testcase_13 AC 92 ms
33,540 KB
testcase_14 AC 31 ms
25,256 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.Linq;
using System.Text;
using static System.Console;
using static System.Math;

namespace AtTest.yukicoder
{
    class _475
    {
        static void Main(string[] args)
        {
            Method(args);
        }

        static void Method(string[] args)
        {
            int[] nsw = ReadInts();
            int n = nsw[0];
            int s = nsw[1];
            int w = nsw[2];
            long[] prevArray = new long[n - 1];
            int[] array = ReadInts();
            for (int i = 0; i < n; i++)
            {
                if (i < w) prevArray[i] = array[i];
                if (i > w) prevArray[i - 1] = array[i];
            }
            prevArray = prevArray.OrderBy(a => -a).ToArray();

            int writerTotal = array[w] + 100 * s;

            int[] points = new int[n - 1];
            for (int i = 0; i < n - 1; i++)
            {
                points[i] = 50 * s + 500 * s / (8 + 2 * (i + 1));
            }
            double res = 1;
            int pointI = n - 2;
            for (int i = 0; i < n - 1; i++)
            {
                while (pointI >= 0
                    && prevArray[i] + points[pointI] <= writerTotal)
                {
                    pointI--;
                }
                pointI++;
                if (n - 1 - pointI - i <= 0)
                {
                    WriteLine(0);
                    return;
                }
                res *= n - 1 - pointI - i;
                res /= (n-i-1);
            }
            WriteLine(res);
        }

        private static string Read() { return ReadLine(); }
        private static char[] ReadChars() { return Array.ConvertAll(Read().Split(), a => a[0]); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
    }
}
0